/* assets/css/style.css */
:root {
    --primary-color: #4F46E5; /* Indigo 600 */
    --primary-hover: #4338CA;
    --secondary-color: #10B981; /* Emerald 500 */
    --background-color: #F3F4F6; /* Gray 100 */
    --text-color: #1F2937; /* Gray 800 */
    --text-light: #6B7280;
    --white: #FFFFFF;
    --border-color: #E5E7EB;
    --danger-color: #EF4444;
    --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);
    --border-radius: 0.5rem;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

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

ul {
    list-style: none;
}

/* Header & Navbar */
header {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1280px;
    margin: 0 auto;
}

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

.logo span {
    color: var(--secondary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links li a {
    color: var(--text-color);
    font-weight: 500;
}

.nav-links li a:hover {
    color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    border: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white) !important;
}

.btn-secondary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white) !important;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 5%;
    min-height: calc(100vh - 200px);
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

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

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

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

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

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #34D399;
}

.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #F87171;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    border-radius: var(--border-radius);
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #F9FAFB;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    font-size: 0.85rem;
}

tr:hover {
    background-color: #F9FAFB;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #E5E7EB;
    color: var(--text-color);
}

.badge-new {
    background-color: #FEE2E2;
    color: var(--danger-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Footer */
footer {
    background-color: #1F2937;
    color: var(--white);
    padding: 2rem 5%;
    text-align: center;
    margin-top: auto;
}

footer a {
    color: var(--secondary-color);
}

footer a:hover {
    color: var(--white);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Section filter buttons (FreeJobAlert style) */
.section-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-filter {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #1e73be;
    color: #ffffff !important;
    border-radius: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.section-filter:hover {
    background-color: #155a8a;
    transform: translateY(-1px);
}

.section-filter.active {
    background-color: #0f3a5c;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Jobs table header styled like FreeJobAlert */
.jobs-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.jobs-table th,
.jobs-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.jobs-table th {
    background-color: #116a8d;
    color: #ffffff;
    text-transform: none;
    font-weight: 600;
    border-bottom: 2px solid #0e5a78;
    text-align: center;
    white-space: nowrap;
}

/* Column widths so all 8 job-listing columns fit without horizontal scroll */
.jobs-table .col-date    { width: 9%; }
.jobs-table .col-board   { width: 18%; }
.jobs-table .col-post    { width: 18%; }
.jobs-table .col-qual    { width: 13%; }
.jobs-table .col-advt    { width: 10%; }
.jobs-table .col-start   { width: 10%; }
.jobs-table .col-end     { width: 10%; }
.jobs-table .col-action  { width: 12%; }

.jobs-table .col-action .btn {
    white-space: normal;
    line-height: 1.25;
}

.jobs-table .col-date,
.jobs-table .col-start,
.jobs-table .col-end,
.jobs-table .col-action {
    text-align: center;
}

/* Detail page cards */
.detail-card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.detail-card-title {
    font-size: 1.4rem;
    color: #0f5e5e;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0f2f1;
}

.detail-featured-image {
    flex: 0 0 auto;
    max-width: 220px;
}

.detail-featured-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .detail-featured-image {
        max-width: 100%;
        width: 100%;
        margin-top: 1rem;
    }
}

.detail-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.detail-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    border-bottom: 1px solid var(--border-color);
}

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

.detail-label {
    background-color: #f0f9f9;
    color: #0f5e5e;
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--border-color);
}

.detail-value {
    padding: 1rem 1.25rem;
    background-color: var(--white);
}

.text-muted {
    color: var(--text-light);
}

.text-success {
    color: #059669;
}

.text-warning {
    color: #d97706;
}

.text-danger {
    color: #dc2626;
}

/* Lifecycle timeline */
.lifecycle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.lifecycle-step {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    position: relative;
    opacity: 0.7;
}

.lifecycle-step.active {
    background-color: #f0fdfa;
    border-color: #14b8a6;
    opacity: 1;
}

.lifecycle-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto 0.75rem;
}

.lifecycle-step.active .lifecycle-icon {
    background-color: #0f766e;
    color: var(--white);
}

.lifecycle-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.lifecycle-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.lifecycle-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Disclaimer */
.disclaimer-card {
    background-color: #fffbeb;
    border-color: #fde68a;
}

.disclaimer-card .detail-card-title {
    color: #92400e;
    border-bottom-color: #fde68a;
}

@media (max-width: 768px) {
    .detail-row {
        grid-template-columns: 1fr;
    }
    .detail-label {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .lifecycle {
        grid-template-columns: repeat(2, 1fr);
    }
}

.pdf-viewer {
    width: 100%;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.pdf-viewer iframe {
    display: block;
    min-height: 500px;
}

@media (max-width: 768px) {
    .pdf-viewer iframe {
        min-height: 350px;
    }
}


/* ============================= */
/* RESPONSIVE & ATTRACTIVE UI    */
/* ============================= */

/* Mobile-first enhancements */
html {
    scroll-behavior: smooth;
}

img {
    max-width: 100%;
    height: auto;
}

/* Navbar mobile menu toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
}

.nav-toggle svg {
    width: 28px;
    height: 28px;
}

/* Improved buttons for touch */
.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    min-height: 36px;
}

/* Card enhancements */
.card {
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

/* Page header banner */
.page-banner {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7C3AED 100%);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.page-banner h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-banner p {
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.page-banner a {
    color: #E0E7FF;
    text-decoration: underline;
}

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Improved tables */
.table-responsive {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background: white;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}



/* Quiz card improvements */
.quiz-list-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    transition: var(--transition);
}

.quiz-list-card:hover {
    transform: translateY(-3px);
}

.quiz-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #EEF2FF;
    border-radius: 50%;
}

.quiz-icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

/* Current affairs grid */
.ca-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Sidebar archive */
.archive-list li {
    margin-bottom: 0.5rem;
}

.archive-list a {
    display: inline-block;
    padding: 0.35rem 0;
    color: var(--text-color);
    transition: var(--transition);
}

.archive-list a:hover {
    color: var(--primary-color);
    transform: translateX(4px);
}

.archive-list a.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Hero section */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7C3AED 100%);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

/* Section headings */
.section-heading {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Filter cards */
.filter-card {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
}

/* Form responsive */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.form-inline .form-control {
    width: auto;
    min-width: 200px;
}

/* Footer improvements */
footer {
    padding: 2.5rem 5%;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: left;
    max-width: 1280px;
    margin: 0 auto 2rem;
}

.footer-grid h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: white;
}

.footer-grid ul li {
    margin-bottom: 0.5rem;
}

.footer-grid ul li a {
    color: #D1D5DB;
    font-size: 0.9rem;
}

.footer-grid ul li a:hover {
    color: var(--secondary-color);
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1.5rem;
    font-size: 0.9rem;
    color: #9CA3AF;
}

/* ============================= */
/* TABLET & MOBILE BREAKPOINTS   */
/* ============================= */

@media (max-width: 992px) {
    .container {
        margin: 1.5rem auto;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .page-banner h1 {
        font-size: 1.75rem;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 4%;
        position: relative;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: var(--white);
        padding: 1rem 4%;
        gap: 0;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--border-color);
        z-index: 99;
    }

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

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

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

    .nav-links li a {
        display: block;
        padding: 0.75rem 0;
        width: 100%;
    }

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

    .container {
        padding: 0 4%;
        margin: 1rem auto;
    }

    .hero-section {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .page-banner {
        padding: 1.5rem 1rem;
    }

    .page-banner h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.25rem;
    }

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

    /* Stack homepage 3-column grid */
    .home-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stack current affairs / quiz 2-column layouts */
    .content-with-sidebar {
        grid-template-columns: 1fr !important;
    }

    .content-with-sidebar > div:last-child {
        order: -1;
    }

    .quiz-list-card {
        flex-direction: column;
        text-align: center;
    }

    .quiz-list-card > div:last-child {
        width: 100%;
    }

    .ca-grid {
        grid-template-columns: 1fr;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-control {
        width: 100%;
    }

    .section-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }

    .detail-row {
        grid-template-columns: 1fr;
    }

    .detail-label {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .lifecycle {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    th, td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .section-heading {
        font-size: 1.25rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .lifecycle {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .btn-sm {
        width: auto;
    }

    .page-banner h1 {
        font-size: 1.35rem;
    }

    .card {
        padding: 1rem;
    }

    th, td {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

/* iOS safe area support */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(4%, env(safe-area-inset-left));
        padding-right: max(4%, env(safe-area-inset-right));
    }
}

/* Remove tap highlight on mobile */
a, button {
    -webkit-tap-highlight-color: transparent;
}

/* Print styles */
@media print {
    header, footer, .btn, .nav-toggle {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}
