:root {
    --primary-color: #5e75b3;
    --primary-dark: #4a5d8f;
    --primary-light: #7b8fc5;
    --secondary-color: #e74c3c;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --white: #ffffff;
    --black: #212529;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--black);
    background-color: var(--light-color);
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

img {
    max-width: 100%;
}

.header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container img {
    height: 50px;
    margin-right: 15px;
}

.logo-text h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.logo-text p {
    color: var(--gray-color);
    font-size: 1rem;
    font-weight: 500;
}

.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 300px);
}

.verification-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    text-align: center;
    margin-bottom: 3rem;
}

.verification-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.verification-card p {
    color: var(--gray-color);
    margin-bottom: 1.5rem;
}

.verification-form {
    max-width: 500px;
    margin: 0 auto;
}

.verification-form .form-group {
    margin-bottom: 1rem;
}

.verification-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-verify {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-verify:hover {
    background-color: var(--primary-dark);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    text-align: center;
}

.info-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background-color: rgba(94, 117, 179, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--gray-color);
    font-size: 0.9rem;
}

.certificate-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 2rem;
}

.certificate-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1.5rem 2rem;
}

.certificate-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.certificate-id {
    font-size: 0.9rem;
    opacity: 0.8;
}

.certificate-body {
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.certificate-details {
    flex: 1;
    min-width: 300px;
}

.certificate-details p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.certificate-details strong {
    color: var(--primary-dark);
    display: inline-block;
    width: 100px;
}

.verification-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.qr-code {
    text-align: center;
}

.qr-code img {
    width: 180px;
    height: 180px;
    border: 1px solid #eee;
    padding: 10px;
    background: white;
}

.verification-status {
    text-align: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.status-badge.verified {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.status-badge svg {
    width: 16px;
    height: 16px;
}

.certificate-footer {
    padding: 1.5rem 2rem;
    background-color: #f9f9f9;
    text-align: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-download {
    background-color: var(--primary-color);
    color: white;
}

.btn-download:hover {
    background-color: var(--primary-dark);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.error-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 3rem 2rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.error-icon {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 1.5rem;
}

.error-card h2 {
    color: var(--warning-color);
    margin-bottom: 1rem;
}

.error-card p {
    margin-bottom: 1rem;
    color: var(--gray-color);
}

.footer, .site-footer {
    background-color: var(--dark-color);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 3rem;
    position: relative;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-left img {
    height: 50px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.footer-logo-text {
    display: flex;
    flex-direction: column;
}

.footer-logo-text h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--white);
}

.footer-logo-text p {
    margin: 5px 0 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer-center {
    flex: 1;
    text-align: center;
    padding: 0 1rem;
}

.footer-center p {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-right {
    flex-shrink: 0;
}

.footer-right img {
    height: 45px;
    width: auto;
}

/* Admin Container Fixes */
.admin-container {
    display: flex;
    min-height: 100vh;
    background-color: #f8f9fa;
}

.admin-sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    padding: 1.5rem 0;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-header img {
    height: 50px;
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.sidebar-header p {
    font-size: 0.8rem;
    opacity: 0.7;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.sidebar-nav a {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav a.active {
    background-color: #5e75b3;
    color: white;
}

.sidebar-nav svg {
    width: 18px;
    height: 18px;
}

.admin-main {
    flex: 1;
    background-color: #f8f9fa;
    margin-left: 250px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
}

.admin-header {
    background-color: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: #333;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: auto; /* Allow horizontal scrolling */
}

.admin-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-footer {
    background: white;
    border-top: 1px solid #dee2e6;
    padding: 1.5rem 2rem;
    margin-top: auto;
}

.admin-footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.admin-footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-footer-logo img {
    height: 35px;
    width: auto;
}

.admin-footer-text {
    flex: 1;
    text-align: center;
    color: var(--gray-color);
    font-size: 0.85rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    border: none;
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
    border: none;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
}

.btn-secondary {
    background-color: var(--gray-color);
    color: white;
    border: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

/* FIXED FORM CONTAINER - Main Fix */
.form-container {
    width: calc(100% - 40px); /* Full width minus margins */
    max-width: none !important; /* Remove any max-width restrictions */
    margin: 20px auto;
    padding: 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: visible; /* Ensure content is not hidden */
    min-height: auto; /* Allow container to grow with content */
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    word-wrap: break-word;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    resize: vertical;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(94, 117, 179, 0.2);
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: var(--primary-dark);
}

.error-message {
    color: var(--danger-color);
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
    word-wrap: break-word;
}

.success-message {
    color: var(--success-color);
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
    word-wrap: break-word;
}

/* FIXED TABLE RESPONSIVE - Main Fix */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
    /* Remove any height restrictions */
    max-height: none !important;
    height: auto !important;
}

.certificate-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    min-width: 1200px; /* Ensure table has minimum width for all columns */
    background: white;
    table-layout: auto; /* Allow columns to size naturally */
}

.certificate-table th,
.certificate-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    word-wrap: break-word;
}

.certificate-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #6c757d;
    font-size: 0.85rem;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.certificate-table tr:hover {
    background-color: #f8f9fa;
}

/* FIXED TABLE ACTIONS - Main Fix */
.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap; /* Prevent wrapping to new line */
    align-items: center;
    justify-content: flex-start;
    min-width: 220px; /* Ensure enough space for all buttons */
}

.table-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Specific column widths to ensure proper display */
.certificate-table th:first-child,
.certificate-table td:first-child {
    width: 60px; /* ID column */
}

.certificate-table th:nth-child(2),
.certificate-table td:nth-child(2) {
    width: 150px; /* Certificate Number */
}

.certificate-table th:nth-child(3),
.certificate-table td:nth-child(3) {
    width: 180px; /* Recipient */
    max-width: 180px;
}

.certificate-table th:nth-child(4),
.certificate-table td:nth-child(4) {
    width: 200px; /* Course */
    max-width: 200px;
}

.certificate-table th:nth-child(5),
.certificate-table td:nth-child(5) {
    width: 120px; /* Issue Date */
}

.certificate-table th:nth-child(6),
.certificate-table td:nth-child(6) {
    width: 120px; /* Expiry Date */
}

.certificate-table th:nth-child(7),
.certificate-table td:nth-child(7) {
    width: 100px; /* Status */
}

.certificate-table th:last-child,
.certificate-table td:last-child {
    width: 220px; /* Actions column */
    min-width: 220px;
}

.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    border: 2px dashed #ddd;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.file-upload:hover {
    border-color: var(--primary-color);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-upload-text {
    color: var(--gray-color);
    word-wrap: break-word;
}

.file-name {
    margin-top: 1rem;
    font-weight: 600;
    color: #333;
    word-wrap: break-word;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(94, 117, 179, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.login-container {
    max-width: 400px;
    margin: 5rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header img {
    height: 60px;
    margin-bottom: 1rem;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-login:hover {
    background-color: var(--primary-dark);
}

/* Enhanced highlight animation */
.highlight-row {
    animation: highlight-fade 3s ease-out;
    background-color: rgba(94, 117, 179, 0.1) !important;
}

@keyframes highlight-fade {
    0% { background-color: rgba(94, 117, 179, 0.3); }
    100% { background-color: rgba(94, 117, 179, 0.1); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .certificate-body {
        flex-direction: column;
    }
    
    .certificate-details {
        margin-bottom: 1.5rem;
    }
    
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        position: static;
        width: 100%;
        height: auto;
        order: 2;
    }
    
    .admin-main {
        margin-left: 0;
        order: 1;
    }
    
    .admin-header {
        padding: 1rem;
    }
    
    .admin-content {
        padding: 1rem;
    }
    
    .form-container {
        width: calc(100% - 20px);
        margin: 10px auto;
        padding: 15px;
    }
    
    .table-responsive {
        margin: 0;
        border-radius: 0;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 5px;
        min-width: auto;
    }
    
    .table-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .footer-left {
        justify-content: center;
    }
    
    .admin-footer-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .admin-actions {
        width: 100%;
        justify-content: center;
    }
    
    .certificate-table th,
    .certificate-table td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .certificate-table {
        min-width: 1000px;
    }
}

@media (max-width: 480px) {
    .form-container {
        width: calc(100% - 10px);
        margin: 5px auto;
        padding: 10px;
        border-radius: 0;
    }
    
    .admin-content {
        padding: 0.5rem;
    }
    
    .admin-header {
        padding: 0.5rem;
    }
    
    .admin-header h1 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .certificate-table th,
    .certificate-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}

/* Text handling */
.word-break {
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* QR code display */
.qr-preview img,
.qr-code img {
    max-width: 100%;
    height: auto;
}

/* Certificate details display */
.certificate-details p,
.detail-value {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Certificate number code display */
.certificate-table code {
    word-wrap: break-word;
    white-space: normal;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section header for consistency */
.section-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
/* إضافة بسيطة لتحسين شكل العنوان */
.certificates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.certificates-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.certificates-count {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.search-section {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}