/* ── MHT CET Engineering College Predictor — Responsive Design System ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-subtle: #e2e8f0;

    --border-subtle: #cbd5e1;
    --border-medium: #94a3b8;
    --border-active: #2563eb;

    --text-heading: #0f172a;
    --text-body: #1e293b;
    --text-muted: #334155; /* Slate-700 (High WCAG AAA contrast ratio > 7:1) */

    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    --primary-border: #93c5fd;

    --safe-color: #047857;
    --safe-bg: #ecfdf5;
    --safe-border: #6ee7b7;

    --target-color: #b45309;
    --target-bg: #fffbeb;
    --target-border: #fde047;

    --ambitious-color: #be185d;
    --ambitious-bg: #fdf2f8;
    --ambitious-border: #f472b6;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);

    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
    --bg-page: #0f172a;
    --bg-surface: #1e293b;
    --bg-muted: #334155;
    --bg-subtle: #475569;

    --border-subtle: #475569;
    --border-medium: #64748b;
    --border-active: #3b82f6;

    --text-heading: #ffffff;
    --text-body: #f1f5f9;
    --text-muted: #cbd5e1; /* Slate-300 (High WCAG AAA contrast ratio > 9:1) */

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.2);
    --primary-border: rgba(59, 130, 246, 0.4);

    --safe-color: #34d399;
    --safe-bg: rgba(52, 211, 153, 0.15);
    --safe-border: rgba(52, 211, 153, 0.4);

    --target-color: #fbbf24;
    --target-bg: rgba(251, 191, 36, 0.15);
    --target-border: rgba(251, 191, 36, 0.4);

    --ambitious-color: #f472b6;
    --ambitious-bg: rgba(244, 114, 182, 0.15);
    --ambitious-border: rgba(244, 114, 182, 0.4);
}

html, body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.55;
    min-height: 100vh;
}

* {
    box-sizing: border-box;
    font-family: var(--font-body);
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-heading);
}

/* ── Top Header Navigation ───────────────────────────────────────── */
.navbar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
    width: 100%;
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}

.navbar-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.navbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-links-desktop {
    display: flex;
    align-items: center;
    gap: 16px;
}

@media (max-width: 768px) {
    .nav-links-desktop {
        display: none !important;
    }
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Compact Icon Buttons for Android View */
.btn-header-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-heading);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-header-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-header-basket {
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-heading);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-header-basket:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.badge-counter {
    background: var(--primary);
    color: white;
    font-size: 0.725rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* ── Main Layout Container ───────────────────────────────────────── */
.main-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 12px 32px 12px;
    width: 100%;
}

@media (min-width: 640px) {
    .main-layout {
        padding: 20px 16px 40px 16px;
    }
}

.hero-banner {
    margin-bottom: 20px;
}

.hero-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.badge-tag {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
}

.hero-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.25;
    margin-bottom: 6px;
}

@media (min-width: 640px) {
    .hero-title {
        font-size: 1.75rem;
    }
}

.hero-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ── Grid System ─────────────────────────────────────────────────── */
.grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
}

@media (min-width: 1024px) {
    .grid-container {
        grid-template-columns: 380px 1fr;
    }
}

.card-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

@media (min-width: 640px) {
    .card-box {
        padding: 20px;
    }
}

.card-box-header {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-box-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
}

.card-box-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Form Controls (Android Touch Friendly) ──────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.input-control, .select-control {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-heading);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
}

.select-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.input-control:focus, .select-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.segmented-control {
    display: flex;
    background: var(--bg-muted);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    width: 100%;
}

.segmented-btn {
    flex: 1;
    min-height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--text-body);
    opacity: 0.8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.segmented-btn.active {
    background: var(--bg-surface);
    color: var(--primary);
    opacity: 1;
    box-shadow: var(--shadow-xs);
}

.chip-set {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-grid-caste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 6px;
    width: 100%;
}

.chip-item {
    min-height: 36px;
    padding: 4px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--text-body);
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    user-select: none;
}

.chip-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-primary-action {
    width: 100%;
    min-height: 46px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(29, 78, 216, 0.25);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

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

/* ── Results Cards ───────────────────────────────────────────────── */
.tier-group {
    margin-bottom: 20px;
}

.tier-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-size: 0.875rem;
    font-weight: 700;
}

.tier-group-safe { background: var(--safe-bg); border: 1px solid var(--safe-border); color: var(--safe-color); }
.tier-group-target { background: var(--target-bg); border: 1px solid var(--target-border); color: var(--target-color); }
.tier-group-ambitious { background: var(--ambitious-bg); border: 1px solid var(--ambitious-border); color: var(--ambitious-color); }

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-xs);
    width: 100%;
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.college-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.3;
}

.branch-name {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pill-match {
    font-size: 0.725rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.pill-safe { background: var(--safe-bg); color: var(--safe-color); border: 1px solid var(--safe-border); }
.pill-target { background: var(--target-bg); color: var(--target-color); border: 1px solid var(--target-border); }
.pill-ambitious { background: var(--ambitious-bg); color: var(--ambitious-color); border: 1px solid var(--ambitious-border); }

.stats-bar {
    background: var(--bg-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin: 8px 0;
}

.btn-basket-add {
    width: 100%;
    min-height: 36px;
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-basket-add.added {
    background: var(--safe-color);
    border-color: var(--safe-color);
    color: white;
}

/* ── Interactive Modal Guide Overlay ────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* ── Basket Drawer Sheet ─────────────────────────────────────────── */
.basket-sheet {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--bg-surface);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    padding: 16px;
    display: flex;
    flex-direction: column;
    transition: right 0.25s ease;
}

@media (max-width: 640px) {
    .basket-sheet {
        width: 100%;
        right: -100%;
    }
}

.basket-sheet.open {
    right: 0;
}

.basket-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 14px;
}

.basket-item-row {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.825rem;
}

.hidden { display: none !important; }
.print-only { display: none; }

/* ── Print Document Rules ───────────────────────────────────────── */
@media print {
    body * { display: none !important; }
    #print-area, #print-area * { display: block !important; visibility: visible !important; }
    #print-area table { display: table !important; width: 100% !important; border-collapse: collapse !important; }
    #print-area tr { display: table-row !important; }
    #print-area th, #print-area td { display: table-cell !important; padding: 6px 10px !important; border: 1px solid #000 !important; font-size: 10pt !important; color: #000 !important; text-align: left !important; }
    #print-area { position: absolute !important; left: 0 !important; top: 0 !important; width: 100% !important; padding: 15px !important; background: #fff !important; color: #000 !important; }
}
