/* HK Jobs Web Server - Modern Design System */

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

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

:root {
    /* Primary Palette */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-deeper: #1e40af;
    --primary-light: #dbeafe;
    --primary-subtle: #eff6ff;

    /* Secondary / Accent */
    --secondary-color: #0f766e;
    --secondary-light: #ccfbf1;
    --accent-color: #7c3aed;
    --accent-light: #ede9fe;

    /* Semantic Colors */
    --success-color: #16a34a;
    --success-light: #dcfce7;
    --warning-color: #d97706;
    --warning-light: #fef3c7;
    --error-color: #dc2626;
    --error-light: #fee2e2;

    /* Neutrals */
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-dark: #1e293b;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Company Badge Colors */
    --hkex-color: #e74c3c;
    --hkjc-color: #3498db;
    --bochk-color: #9b59b6;
    --hkclp-color: #e67e22;
    --hkmtr-color: #16a34a;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

    /* Layout */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== Header ==================== */
header {
    background: linear-gradient(135deg, var(--primary-deeper) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    min-height: 80px;
    display: flex;
    align-items: center;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 20px 0;
}

header h1 {
    font-size: 1.6em;
    margin-bottom: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 12px;
}

header h1 a {
    color: white;
    text-decoration: none;
}

header h1 i {
    font-size: 0.9em;
    opacity: 0.9;
}

/* ==================== User Menu ==================== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

#user-status {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    font-size: 0.9em;
    display: none;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-pill);
    backdrop-filter: blur(4px);
}

.btn-signin {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all var(--transition-base);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.btn-signin:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.btn-logout {
    background: rgba(255, 82, 82, 0.2);
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(255, 82, 82, 0.35);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all var(--transition-base);
    backdrop-filter: blur(4px);
}

.btn-logout:hover {
    background: rgba(255, 82, 82, 0.35);
    border-color: rgba(255, 82, 82, 0.6);
    transform: translateY(-1px);
}

/* Upgrade button in header */
.btn-upgrade {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all var(--transition-base);
    margin-right: 4px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
}

.btn-upgrade:active {
    transform: translateY(0);
}

/* ==================== Search Section ==================== */
.search-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.search-container {
    margin-bottom: 0;
    position: relative;
}

.search-container::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.95em;
    z-index: 1;
    pointer-events: none;
}

.search-box {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95em;
    font-family: inherit;
    transition: all var(--transition-base);
    background: var(--light-bg);
    color: var(--text-dark);
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--card-bg);
}

.search-box::placeholder {
    color: var(--text-light);
}

/* ==================== Filter Section ==================== */
.filter-section {
    display: block;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.filter-section h3 {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 7px 16px;
    background-color: var(--light-bg);
    color: var(--text-muted);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85em;
    font-family: inherit;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.filter-btn:hover {
    background-color: var(--primary-subtle);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* ==================== Jobs Section ==================== */
.jobs-section {
    background: var(--card-bg);
    padding: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.jobs-section h2 {
    font-size: 1.4em;
    padding: 20px 24px;
    margin: 0;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

/* ==================== Table ==================== */
.jobs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.jobs-table thead {
    background-color: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.jobs-table th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.jobs-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.92em;
    color: var(--text-body);
}

.jobs-table tbody tr {
    transition: background-color var(--transition-fast);
}

.jobs-table tbody tr:hover {
    background-color: var(--primary-subtle);
}

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

.job-title {
    font-weight: 600;
    color: var(--primary-color);
    max-width: 300px;
    word-wrap: break-word;
}

/* ==================== Badges ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-hkex {
    background-color: #fee2e2;
    color: var(--hkex-color);
}

.badge-hkjc {
    background-color: #dbeafe;
    color: var(--hkjc-color);
}

.badge-bochk {
    background-color: #f3e8ff;
    color: var(--bochk-color);
}

.badge-hkclp {
    background-color: #fed7aa;
    color: var(--hkclp-color);
}

.badge-hkmtr {
    background-color: #dcfce7;
    color: var(--hkmtr-color);
}

.badge-default {
    background-color: #f1f5f9;
    color: var(--text-muted);
}

.badge-hr {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.badge-secretary {
    background-color: #fef3c7;
    color: #b45309;
}

.badge-data {
    background-color: #ede9fe;
    color: #6d28d9;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 8px 18px;
    background-color: var(--card-bg);
    color: var(--text-dark);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    font-size: 0.9em;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-small {
    padding: 6px 14px;
    font-size: 0.82em;
    text-decoration: none;
    display: inline-block;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all var(--transition-base);
}

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

.btn-small.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* ==================== Pagination ==================== */
.pagination-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    width: 100%;
}

.pagination-btn {
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88em;
    font-family: inherit;
    transition: all var(--transition-base);
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
}

.pagination-btn:disabled {
    background-color: var(--border-color);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.7;
}

.pagination-info {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.88em;
    white-space: nowrap;
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1.05em;
    margin: 10px 0;
}

/* ==================== Loading & Error States ==================== */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1em;
    font-weight: 500;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 10px;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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

.error {
    background-color: var(--error-light);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    text-align: center;
    margin: 20px;
}

.error p {
    margin: 0;
    font-size: 0.95em;
    font-weight: 500;
}

/* ==================== Footer ==================== */
footer {
    text-align: center;
    padding: 28px 20px;
    margin-top: 40px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

footer p {
    font-size: 0.85em;
    line-height: 1.8;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

footer .footer-icon {
    margin-right: 4px;
    opacity: 0.7;
}

/* ==================== Utility Classes ==================== */
.text-muted {
    color: var(--text-muted);
}

.text-muted.small, .small {
    font-size: 0.85em;
}

/* ==================== Stats Section (hidden) ==================== */
.stats-section {
    display: none;
}

/* ==================== Shared Overlays ==================== */
.loading-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.loading-spinner-overlay.show {
    display: flex;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    animation: spin 0.8s linear infinite;
}

.success-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    padding: 14px 22px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 3000;
    animation: slideInRight 0.4s ease;
    font-weight: 500;
    font-size: 0.92em;
}

.success-banner.show {
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.success-banner.hide {
    animation: slideOutRight 0.4s ease forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.error-message {
    background: var(--error-light);
    border-left: 4px solid var(--error-color);
    color: #7f1d1d;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin: 16px 0;
    display: none;
    font-weight: 500;
    font-size: 0.92em;
}

.error-message.show {
    display: block;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
    .jobs-table th:nth-child(5),
    .jobs-table td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header {
        border-radius: var(--radius-md);
        padding: 0 16px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
        padding: 16px 0;
        text-align: center;
    }

    header h1 {
        font-size: 1.3em;
        justify-content: center;
    }

    .user-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .search-section {
        padding: 16px;
    }

    .filter-buttons {
        gap: 6px;
    }

    .jobs-section {
        border-radius: var(--radius-md);
    }

    .jobs-table {
        font-size: 0.88em;
    }

    .jobs-table th,
    .jobs-table td {
        padding: 10px 12px;
    }

    .jobs-table th:nth-child(4),
    .jobs-table td:nth-child(4) {
        display: none;
    }

    .job-title {
        max-width: 160px;
    }

    .pagination {
        padding: 12px 16px;
        gap: 10px;
    }

    .pagination-btn {
        padding: 6px 14px;
        font-size: 0.82em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.15em;
    }

    .jobs-table {
        font-size: 0.8em;
    }

    .jobs-table th,
    .jobs-table td {
        padding: 8px 6px;
    }

    .jobs-table th:nth-child(3),
    .jobs-table td:nth-child(3) {
        display: none;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 0.75em;
    }

    .badge {
        padding: 3px 7px;
        font-size: 0.7em;
    }
}

/* ==================== Pro Badge Styling ==================== */
.pro-badge {
    display: inline-block;
    padding: 6px 12px;
    margin-left: 8px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffc700 100%);
    color: #333;
    font-weight: 700;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    animation: badgePulse 2s ease-in-out infinite;
    white-space: nowrap;
    user-select: none;
}

.pro-badge::before {
    content: "★ ";
    margin-right: 2px;
}

.pro-badge::after {
    content: " ★";
    margin-left: 2px;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    }
}
