/* assets/css/ui-enhancements.css
 * Impressive UI enhancements: dark mode, modern hero, mobile tables,
 * back-to-top, footer socials, and responsive polish.
 */

/* ================================
   CSS Variables & Dark Mode
   ================================ */
:root {
    --bg: #F3F4F6;
    --background-color: #F3F4F6;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --white: #FFFFFF;
    --text: #1F2937;
    --text-color: #1F2937;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --border-color: #E5E7EB;
    --input-bg: #FFFFFF;
    --hover-bg: #F9FAFB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 0.75rem;
    --border-radius: 0.75rem;
    --radius-lg: 1rem;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="dark"] {
    --bg: #0F172A;
    --background-color: #0F172A;
    --surface: #1E293B;
    --surface-elevated: #26334D;
    --white: #FFFFFF;
    --text: #F1F5F9;
    --text-color: #F1F5F9;
    --text-light: #94A3B8;
    --border: #334155;
    --border-color: #334155;
    --input-bg: #0F172A;
    --hover-bg: #26334D;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

body {
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.card,
.detail-card,
.filter-card,
.disclaimer-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Dark mode overrides for elements still using legacy variables */
html[data-theme="dark"] header,
html[data-theme="dark"] .card,
html[data-theme="dark"] .detail-card,
html[data-theme="dark"] .filter-card,
html[data-theme="dark"] .disclaimer-card,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input:not(.hero-search input) {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] .nav-links {
    background-color: var(--surface);
}

html[data-theme="dark"] .nav-links li a {
    color: var(--text);
}

html[data-theme="dark"] .nav-links li a:hover {
    color: var(--primary-color);
}

html[data-theme="dark"] .page-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #4F46E5 100%);
}

html[data-theme="dark"] footer {
    background: #0b1221;
}

html[data-theme="dark"] .jobs-table td,
html[data-theme="dark"] .jobs-table th {
    border-color: var(--border);
}

html[data-theme="dark"] .detail-label {
    background: var(--surface-elevated);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .detail-value {
    background: var(--surface);
}

html[data-theme="dark"] table {
    background-color: var(--surface);
}

html[data-theme="dark"] .section-filter {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] .section-filter.active,
html[data-theme="dark"] .section-filter:hover {
    background: var(--primary-color);
    color: #fff;
}

/* ================================
   Dark mode toggle
   ================================ */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-links li {
    white-space: nowrap;
}

.navbar .logo,
.navbar .nav-actions {
    flex-shrink: 0;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ================================
   Modern Hero
   ================================ */
.hero-modern {
    position: relative;
    padding: 4rem 5%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7C3AED 50%, #4F46E5 100%);
    color: #fff;
    overflow: hidden;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    margin-bottom: 2.5rem;
}

.hero-modern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.08) 0%, transparent 35%);
    pointer-events: none;
}

.hero-modern .hero-content {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    text-align: center;
}

.hero-modern h1 {
    font-size: clamp(1.85rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.hero-modern p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.92;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.hero-search {
    max-width: 680px;
    margin: 0 auto 2rem;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 9999px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.hero-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    outline: none;
}

.hero-search input::placeholder {
    color: rgba(255,255,255,0.75);
}

.hero-search button {
    background: #fff;
    color: var(--primary-color);
    border: none;
    border-radius: 9999px;
    padding: 0.85rem 1.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.hero-search button:hover {
    background: #F3F4F6;
    transform: scale(1.02);
}

.hero-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.hero-chip:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    transform: translateY(-2px);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto;
}

.hero-stat {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    backdrop-filter: blur(4px);
}

.hero-stat strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.hero-stat span {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ================================
   Section headings
   ================================ */
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.section-heading h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}

.section-heading a {
    font-size: 0.9rem;
    font-weight: 600;
}

/* ================================
   Quiz cards
   ================================ */
.quiz-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    padding-top: 2rem;
}

.quiz-card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color), #7C3AED);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-card-icon svg {
    width: 32px;
    height: 32px;
}

/* ================================
   Mobile navigation overlay
   ================================ */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ================================
   Pagination
   ================================ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.65rem;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.pagination-link:hover:not(.disabled):not(.active) {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
}

.pagination-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    cursor: default;
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 1rem 0 0.5rem;
}

/* ================================
   Back to top
   ================================ */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 90;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.back-to-top svg {
    width: 22px;
    height: 22px;
}

/* ================================
   Footer socials
   ================================ */
.footer-social {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.footer-social a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
}

.footer-social svg {
    width: 18px;
    height: 18px;
}

/* ================================
   Header / nav collapse at 992px
   ================================ */
@media (max-width: 992px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background-color: var(--surface);
        padding: 1rem 4%;
        gap: 0;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--border);
        z-index: 99;
        margin-left: 0;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border);
        white-space: normal;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links li a {
        display: block;
        padding: 0.75rem 0;
        width: 100%;
        color: var(--text);
    }

    .nav-links li a.btn {
        margin: 0.5rem 0;
        text-align: center;
    }

    .nav-toggle {
        display: block;
    }

    .navbar {
        position: relative;
    }
}

/* ================================
   Mobile tables -> cards
   ================================ */
@media (max-width: 768px) {
    .jobs-table thead,
    .jobs-table th {
        display: none;
    }

    .jobs-table,
    .jobs-table tbody,
    .jobs-table tr,
    .jobs-table td {
        display: block;
        width: 100%;
    }

    .jobs-table tr {
        margin-bottom: 1rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .jobs-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--border);
        text-align: right;
    }

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

    .jobs-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
        margin-right: 1rem;
        text-align: left;
    }

    .jobs-table td a {
        word-break: break-word;
        text-align: right;
    }
}

/* ================================
   Responsive hero
   ================================ */
@media (max-width: 768px) {
    .hero-modern {
        padding: 2.5rem 4%;
        border-radius: 0 0 var(--radius) var(--radius);
    }

    .hero-search {
        flex-direction: column;
        border-radius: var(--radius);
    }

    .hero-search button {
        width: 100%;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .hero-categories {
        gap: 0.5rem;
    }

    .hero-chip {
        font-size: 0.8rem;
        padding: 0.4rem 0.85rem;
    }
}

@media (max-width: 480px) {
    .hero-modern h1 {
        font-size: 1.65rem;
    }
}

/* ================================
   Notification content (scraped detail pages)
   ================================ */
.notification-content {
    line-height: 1.8;
    font-size: 1rem;
    color: var(--text);
}

.notification-content > *:first-child {
    margin-top: 0;
}

.notification-content > *:last-child {
    margin-bottom: 0;
}

.notification-content h1,
.notification-content h2,
.notification-content h3,
.notification-content h4,
.notification-content h5,
.notification-content h6 {
    color: var(--primary-color);
    margin: 1.75rem 0 0.75rem;
    line-height: 1.3;
    font-weight: 700;
}

.notification-content h1 { font-size: 1.6rem; }
.notification-content h2 { font-size: 1.4rem; }
.notification-content h3 { font-size: 1.25rem; }
.notification-content h4 { font-size: 1.1rem; }
.notification-content h5 { font-size: 1rem; }
.notification-content h6 { font-size: 0.95rem; }

.notification-content p {
    margin-bottom: 1rem;
    color: var(--text);
}

.notification-content a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.notification-content a:hover {
    color: var(--primary-hover);
}

.notification-content strong,
.notification-content b {
    color: var(--text);
    font-weight: 700;
}

.notification-content ul,
.notification-content ol {
    margin: 1rem 0 1rem 1.5rem;
    padding-left: 1rem;
}

.notification-content ul {
    list-style: disc;
}

.notification-content ol {
    list-style: decimal;
}

.notification-content li {
    margin-bottom: 0.5rem;
}

.notification-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

.notification-content th,
.notification-content td {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.notification-content th {
    background: var(--surface-elevated);
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}

.notification-content tr:nth-child(even) {
    background: var(--hover-bg);
}

.notification-content tr:hover {
    background: var(--surface-elevated);
}

.notification-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.notification-content blockquote {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--primary-color);
    background: var(--hover-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text-muted);
}

.notification-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.notification-content code {
    background: var(--hover-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .notification-content {
        font-size: 0.95rem;
    }

    .notification-content h1 { font-size: 1.35rem; }
    .notification-content h2 { font-size: 1.2rem; }
    .notification-content h3 { font-size: 1.1rem; }

    .notification-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .notification-content th,
    .notification-content td {
        padding: 0.65rem 0.75rem;
    }
}

/* ================================
   Reduced motion
   ================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
