/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background:#fff;  
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
   
    background:#fff;  
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    background:#fff;  
}

/* Header Styles */
.header {
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 25px;
}

.header-icon {
    font-size: 4rem;
    color: #667eea;
    text-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.header-text h1 {
    font-size: 2.8rem;
    color: #2d3748;
    margin-bottom: 5px;
    font-weight: 700;
    line-height: 1.2;
}

.header-text h2 {
    font-size: 1.6rem;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 600;
}

.header-text p {
    font-size: 1.1rem;
    color: #718096;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.btn-admin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.btn-admin:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

/* Statistics Section */
.stats-section {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.8rem;
}

.stat-icon.recent {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.stat-icon.size {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    color: #718096;
    font-size: 1rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    margin-bottom: 40px;
}

.main-content .gallery-section.full-width {
    width: 100%;
}

/* Info Section Styles */
.info-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.info-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.info-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 5px solid #667eea;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.info-card:nth-child(2) {
    border-left-color: #48bb78;
}

.info-card:nth-child(3) {
    border-left-color: #ed8936;
}

.info-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.info-card:nth-child(2) .info-icon {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.info-card:nth-child(3) .info-icon {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.info-content h3 {
    color: #2d3748;
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.info-content p {
    color: #718096;
    font-size: 1rem;
    line-height: 1.6;
}

.cta-section {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 15px;
    border: 2px dashed #cbd5e0;
}

.cta-section h2 {
    color: #2d3748;
    font-size: 2rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.cta-section p {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.1rem;
    border-radius: 12px;
    font-weight: 600;
}

/* Upload Section */
.upload-section {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.upload-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.upload-card h2 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.upload-card h2 i {
    color: #667eea;
    margin-right: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* File Upload Styles */
.file-upload-wrapper {
    position: relative;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-display {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-display:hover {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

.file-upload-display i {
    font-size: 2rem;
    color: #a0aec0;
    display: block;
    margin-bottom: 10px;
}

.file-upload-display span {
    color: #718096;
    font-size: 1rem;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: #667eea;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-info {
    background: #3182ce;
    color: white;
}

.btn-info:hover {
    background: #2c5282;
}

/* Progress Bar */
.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    animation: progressAnimation 2s infinite;
}

@keyframes progressAnimation {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 8px;
    color: #718096;
}

/* Result Container */
.result-container {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.result-container.success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #22543d;
}

.result-container.error {
    background: #fed7d7;
    border: 1px solid #feb2b2;
    color: #742a2a;
}

/* Gallery Section */
.gallery-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    width: 100%;
    min-height: 600px;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 25px;
}

.gallery-title h2 {
    color: #2d3748;
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.gallery-title h2 i {
    color: #667eea;
    margin-right: 12px;
}

.gallery-title p {
    color: #718096;
    font-size: 1rem;
    margin: 0;
}

.gallery-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    min-width: 300px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 1rem;
}

.search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: #f7fafc;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: white;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    width: 100%;
    min-height: 400px;
}

/* Ensure proper spacing for different numbers of certificates */
@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.certificate-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.4s ease;
    border: 1px solid #e2e8f0;
    height: fit-content;
    min-height: 480px;
    display: flex;
    flex-direction: column;
}

.certificate-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.certificate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.certificate-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.certificate-date {
    color: #718096;
    font-size: 0.875rem;
    font-weight: 500;
}

.certificate-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    margin: 0 20px;
    border-radius: 12px;
}

.certificate-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.certificate-card:hover .certificate-image img {
    transform: scale(1.08);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.certificate-card:hover .image-overlay {
    opacity: 1;
}

.btn-view {
    background: rgba(255, 255, 255, 0.9);
    color: #2d3748;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view:hover {
    background: white;
    transform: scale(1.05);
}

.certificate-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.certificate-info {
    margin-bottom: 25px;
}

.student-name {
    color: #2d3748;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.course-name {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.certificate-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-size {
    color: #a0aec0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.qr-code-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.qr-code-container {
    position: relative;
    flex-shrink: 0;
}

.qr-code {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: white;
}

.qr-overlay {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.qr-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.btn-view-qr {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view-qr:hover {
    background: #5a67d8;
}

.btn-download {
    background: #48bb78;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-download:hover {
    background: #38a169;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 100px 40px;
    color: #a0aec0;
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    border: 2px dashed #cbd5e0;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 25px;
    display: block;
    color: #cbd5e0;
}

.empty-state h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #4a5568;
    font-weight: 600;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #718096;
    line-height: 1.6;
}

/* Footer */
.footer {
    margin-top: 60px;
    padding: 40px 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    border-top: 1px solid #e2e8f0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-text {
    color: #718096;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #5a67d8;
}

/* Admin Link */
.admin-link {
    text-align: center;
    margin-top: 30px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

.qr-modal {
    max-width: 500px;
}

.certificate-modal {
    max-width: 800px;
}

.modal-header {
    padding: 30px 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.modal-header p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

.modal-body {
    padding: 40px 30px;
    text-align: center;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    z-index: 1;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

#modalQRImage, #modalCertImage {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
}

.qr-info {
    background: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: left;
}

.qr-info p {
    margin-bottom: 10px;
    color: #4a5568;
}

.qr-info p:last-child {
    margin-bottom: 0;
}

.modal-actions {
    padding: 20px 30px 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    background: #f7fafc;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }
    
    .logo-section {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .header-icon {
        font-size: 3rem;
    }
    
    .header-text h1 {
        font-size: 2.2rem;
    }
    
    .header-text h2 {
        font-size: 1.3rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .stat-card {
        padding: 25px;
    }
    
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .gallery-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-wrapper {
        min-width: 250px;
        flex: 1;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        min-height: 400px;
    }
    
    .certificate-card {
        margin-bottom: 20px;
    }
    
    .qr-code-section {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .qr-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 25px 20px;
    }
    
    .header-text h1 {
        font-size: 1.8rem;
    }
    
    .header-text h2 {
        font-size: 1.1rem;
    }
    
    .stats-section {
        margin-bottom: 30px;
    }
    
    .stat-card {
        padding: 20px;
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .gallery-section {
        padding: 25px 20px;
    }
    
    .gallery-title h2 {
        font-size: 1.5rem;
    }
    
    .gallery-controls {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }
    
    .search-wrapper {
        min-width: 100%;
    }
    
    .certificate-card {
        border-radius: 12px;
    }
    
    .certificate-header {
        padding: 15px 20px 10px;
    }
    
    .certificate-image {
        height: 180px;
        margin: 0 15px;
    }
    
    .certificate-content {
        padding: 20px;
    }
    
    .student-name {
        font-size: 1.2rem;
    }
    
    .course-name {
        font-size: 1rem;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 25px 20px 15px;
    }
    
    .modal-body {
        padding: 30px 20px;
    }
    
    .modal-actions {
        padding: 15px 20px 25px;
        flex-direction: column;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.certificate-card {
    animation: fadeInUp 0.5s ease forwards;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}