/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

a {
    color: #4a6fa5;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navigation Bar */
.navbar {
    background-color: #4a4a4a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 50px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

.navbar-brand:hover {
    text-decoration: none;
    color: #ddd;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.navbar-nav a {
    color: #ccc;
    text-decoration: none;
    padding: 14px 16px;
    display: block;
    font-size: 14px;
    transition: background-color 0.2s;
}

.navbar-nav a:hover {
    background-color: #5a5a5a;
    color: #fff;
    text-decoration: none;
}

.navbar-nav a.active {
    background-color: #666;
    color: #fff;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.navbar-right .admin-name {
    color: #bbb;
}

.logout-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.navbar-right .btn-logout {
    color: #ccc;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid #666;
    border-radius: 3px;
    font-size: 13px;
    transition: background-color 0.2s;
}

.navbar-right .btn-logout:hover {
    background-color: #5a5a5a;
    color: #fff;
    text-decoration: none;
}

/* Content Area */
.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 70px 20px 40px;
}

.content-wide {
    max-width: 1200px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ddd;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #444;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 3px;
    font-size: 14px;
    border-left: 4px solid;
}

.flash-error {
    background-color: #fef2f2;
    border-left-color: #dc2626;
    color: #991b1b;
}

.flash-success {
    background-color: #f0fdf4;
    border-left-color: #16a34a;
    color: #166534;
}

.flash-info {
    background-color: #eff6ff;
    border-left-color: #2563eb;
    color: #1e40af;
}

.flash-warning {
    background-color: #fffbeb;
    border-left-color: #d97706;
    color: #92400e;
}

/* Forms */
fieldset {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #fff;
}

legend {
    font-weight: 600;
    font-size: 15px;
    color: #444;
    padding: 0 8px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #4a6fa5;
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.15);
}

.form-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #5a6268;
    color: #fff;
}

.btn-primary:hover {
    background-color: #4a5258;
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background-color: #aaa;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #999;
    text-decoration: none;
    color: #fff;
}

.btn-danger {
    background-color: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background-color: #b91c1c;
    text-decoration: none;
    color: #fff;
}

.btn-group {
    text-align: right;
    margin-top: 16px;
}

.btn-group .btn {
    margin-left: 8px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 32px;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    font-size: 20px;
    font-weight: 600;
    color: #444;
    text-align: center;
    margin-bottom: 8px;
}

.login-card .subtitle {
    font-size: 13px;
    color: #888;
    text-align: center;
    margin-bottom: 24px;
}

.login-card .btn-primary {
    width: 100%;
    padding: 10px;
    font-size: 15px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.table th {
    background-color: #f0f0f0;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #ddd;
}

.table tr:nth-child(even) {
    background-color: #fafafa;
}

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

/* Status Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-secondary {
    background-color: #e5e7eb;
    color: #374151;
}

/* Page Actions (header with title + button) */
.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Small Buttons */
.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

/* Inline Form (for toggle buttons in tables) */
.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* Table Actions Column */
.actions {
    white-space: nowrap;
}

.actions .btn {
    margin-right: 4px;
}

/* Form Help Text */
.form-help {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* Form Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.form-check label {
    font-weight: 600;
    font-size: 14px;
    color: #444;
    margin: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #999;
    border-top: 1px solid #eee;
    margin-top: 40px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.empty-state p {
    margin-bottom: 16px;
}

/* Dashboard Summary Cards */
.dashboard-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    flex: 1;
    background-color: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid #999;
    padding: 16px 20px;
    text-align: center;
}

.summary-card-total {
    border-left-color: #6b7280;
}

.summary-card-valid {
    border-left-color: #16a34a;
}

.summary-card-expired {
    border-left-color: #dc2626;
}

.summary-card-missing {
    border-left-color: #374151;
}

.summary-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.summary-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* Dashboard Filter */
.dashboard-filter {
    margin-bottom: 20px;
}

.dashboard-filter label {
    font-weight: 600;
    font-size: 14px;
    color: #444;
    margin-right: 8px;
}

.filter-select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
}

.filter-select:focus {
    outline: none;
    border-color: #4a6fa5;
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.15);
}

/* Upload Link Copy */
.upload-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.upload-link-text {
    font-size: 12px;
    color: #666;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-copy {
    background-color: #6b7280;
    color: #fff;
    border: none;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    white-space: nowrap;
}

.btn-copy:hover {
    background-color: #4b5563;
}

.btn-copy-success {
    background-color: #16a34a;
}

/* Certificate Info (read-only display) */
.cert-info {
    font-size: 14px;
}

.cert-info-row {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.cert-info-row:last-child {
    border-bottom: none;
}

.cert-info-label {
    font-weight: 600;
    color: #444;
    display: inline-block;
    min-width: 100px;
}

/* Certificate Actions */
.cert-actions {
    margin-top: 12px;
}

.btn-cert-action {
    background-color: #6b7280;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

.btn-cert-action:hover {
    background-color: #4b5563;
    color: #fff;
    text-decoration: none;
}

/* Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 28px;
    width: 100%;
    max-width: 400px;
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.modal-content p {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.modal-content .form-input {
    margin-bottom: 8px;
}

.modal-content .btn-group {
    margin-top: 16px;
}

/* Upload Pages */
.upload-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
}

.upload-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 32px;
    width: 100%;
    max-width: 700px;
}

.upload-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #ddd;
}

.upload-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #444;
}

.upload-header p {
    font-size: 14px;
    color: #888;
    margin-top: 4px;
}

.success-banner {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #16a34a;
    color: #166534;
    padding: 16px 20px;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}

.btn-success {
    background-color: #16a34a;
    color: #fff;
}

.btn-success:hover {
    background-color: #15803d;
    text-decoration: none;
    color: #fff;
}

.btn-lg {
    padding: 10px 28px;
    font-size: 15px;
}

.file-input {
    padding: 6px;
}

.protocol-text {
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    color: #555;
}

/* Error Pages */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.error-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 40px 32px;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.error-code {
    font-size: 64px;
    font-weight: 700;
    color: #999;
    line-height: 1;
    margin-bottom: 12px;
}

.error-card h1 {
    font-size: 20px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.error-card p {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
}

/* Utility classes (CSP: no unsafe-inline) */
.hidden { display: none; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }

/* Verification page */
.verify-banner--success {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 16px 0;
    text-align: center;
}
.verify-banner--success strong { color: #2e7d32; font-size: 14px; }
.verify-banner--success p { color: #33691e; font-size: 12px; margin: 4px 0 0; }

.verify-banner--error {
    background: #fbe9e7;
    border: 1px solid #e53935;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 16px 0;
    text-align: center;
}
.verify-banner--error strong { color: #c62828; font-size: 14px; }
.verify-banner--error p { color: #b71c1c; font-size: 12px; margin: 4px 0 0; }

.verify-table { width: 100%; }
.verify-table th { text-align: left; padding: 6px 8px; color: #555; width: 40%; }
.verify-table td { padding: 6px 8px; }
.verify-footer { font-size: 11px; color: #888; margin-top: 16px; text-align: center; }
.verify-not-found-footer { font-size: 12px; color: #666; margin-top: 16px; text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
    }

    .navbar-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .content {
        padding: 100px 12px 30px;
    }

    .login-card,
    .upload-card,
    .error-card {
        padding: 24px;
    }

    .upload-container {
        padding: 20px 12px;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 8px 10px;
    }
}
