/* ===========================================================================
   Certificate Verification System — Styles
   Exact match of CCPIT reference screenshots
   =========================================================================== */

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

body {
    font-family: 'Helvetica Neue', Helvetica, sans-serif;
    background: radial-gradient(ellipse 70% 80% at 50% 40%, #ffffff 0%, #e8e8e8 100%);
    background-attachment: fixed;
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

/* --- World Map Dots Background --- */
/* Dot map on top of the white zone */
.bg-pattern {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 1400px;
    height: 600px;
    background: url('https://i.imgur.com/KvVbulm.png') no-repeat center center;
    background-size: contain;
    z-index: 0;
    pointer-events: none;
    opacity: 0.7;
}

/* --- Red Banner Header --- */
.header {
    background: #b70008;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    font-family: 'Courier New', 'Lucida Console', monospace;
    position: relative;
    z-index: 10;
    letter-spacing: 0.5px;
}

/* --- Logo Section --- */
.logo-section {
    text-align: center;
    padding: 20px 20px 0;
    position: relative;
    z-index: 1;
}

.logo-row {
    display: inline-flex;
    align-items: center;
    gap: 18px;
}

/* Logo image */
.ccpit-seal {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    object-fit: contain;
}

.logo-title-cn {
    font-size: 48px;
    font-weight: bold;
    color: #1a1a1a;
    font-family: 'SimHei', 'Heiti SC', 'Microsoft YaHei', sans-serif;
    letter-spacing: 6px;
    line-height: 1.2;
}

/* --- Main Container --- */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
    position: relative;
    z-index: 1;
}

/* --- Search Section --- */
.search-section {
    padding: 20px 80px 40px;
}

.search-label {
    font-size: 14px;
    font-weight: normal;
    color: #ff0029;
    margin-bottom: 8px;
    display: block;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: none;
    background: #d5d5d5;
    color: #333;
    outline: none;
}

.search-input::placeholder {
    color: #888;
}

.search-btn-wrap {
    text-align: center;
    margin-top: 35px;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 18px;
    font-family: 'Georgia', serif;
    color: #0056f3;
    background: transparent;
    border: 1.5px solid #0056f3;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
}

.search-btn:hover {
    background: rgba(0, 86, 243, 0.05);
}

/* --- Results Table (result.html) --- */
.results-section {
    width: 100%;
    position: relative;
    z-index: 1;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #ccc;
}

.results-table th,
.results-table td {
    padding: 18px 24px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
    background: white;
    border: 1px solid #ccc;
}

.results-table th {
    font-weight: normal;
    color: #2c5f8a;
    width: 220px;
}

.results-table td {
    color: #444;
    line-height: 1.5;
}

/* --- Error Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: white;
    border: 1px solid #ccc;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.modal-header {
    padding: 10px 14px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}

.modal-icon-error {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.modal-footer {
    padding: 10px 14px;
    text-align: right;
    border-top: 1px solid #ddd;
}

.modal-btn {
    padding: 5px 18px;
    font-size: 13px;
    font-family: inherit;
    color: white;
    background: #3498db;
    border: none;
    cursor: pointer;
}

.modal-btn:hover {
    background: #2980b9;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(50, 50, 50, 0.9);
    color: white;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Spinner --- */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ===========================================================================
   Admin Styles
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --red-primary: #c0392b;
    --red-dark: #a93226;
    --text-dark: #2c3e50;
    --text-gray: #7f8c8d;
    --border-light: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.25s ease;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    font-family: 'Inter', sans-serif;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h2 {
    color: white;
    text-align: center;
    font-size: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-card .login-subtitle {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    margin-bottom: 32px;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: white;
    outline: none;
    transition: var(--transition);
}

.login-field input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-field input:focus {
    border-color: var(--red-primary);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2);
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.4);
}

.login-error {
    color: #e74c3c;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    text-align: center;
    margin-top: 14px;
    min-height: 20px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #2c3e80, #1a2555);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.logo-icon svg {
    width: 44px;
    height: 44px;
    fill: white;
}

/* --- Admin Dashboard --- */
.admin-layout {
    min-height: 100vh;
    background: #f5f6fa;
    font-family: 'Inter', sans-serif;
}

.admin-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.admin-header h1 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.admin-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-header-actions .username {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.82rem;
    margin-right: 6px;
}

.btn-header {
    padding: 8px 18px;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.15);
}

.admin-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px;
}

.admin-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.admin-card-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.admin-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.btn-primary {
    padding: 10px 22px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: white;
    background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit {
    color: #2980b9;
    background: #ebf5fb;
}

.btn-edit:hover {
    background: #d4e6f1;
}

.btn-delete {
    color: var(--red-primary);
    background: #fdedec;
}

.btn-delete:hover {
    background: #f5b7b1;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #fafbfc;
    border-bottom: 2px solid var(--border-light);
    text-align: left;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #fafbfc;
}

.actions-cell {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.qr-thumb {
    width: 60px;
    height: 60px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.15s;
}

.qr-thumb:hover {
    transform: scale(1.1);
}

.qr-full-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.qr-full-overlay img {
    max-width: 350px;
    background: white;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.admin-modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 560px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.admin-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.admin-modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    background: #f8f9fa;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--red-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.admin-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-cancel {
    padding: 10px 22px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--text-gray);
    background: #f0f0f0;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.settings-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 500px;
    overflow: hidden;
}

.settings-card .admin-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}

.settings-card .admin-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .search-section {
        padding: 20px 16px;
    }

    .logo-title-cn {
        font-size: 24px;
        letter-spacing: 2px;
    }

    .ccpit-seal {
        width: 70px;
        height: 70px;
    }

    .results-table th {
        width: 140px;
    }

    .results-table th,
    .results-table td {
        padding: 12px 14px;
        font-size: 13px;
    }

    .admin-body {
        padding: 16px 12px;
    }
}
