/* ============================================================
   TƯ VẤN TUYỂN SINH - MODERN REDESIGN
   Đẹp, khoa học, cân đối, kiosk-friendly
   ============================================================ */

:root {
    --cr-primary: #1e40af;
    --cr-primary-light: #3b82f6;
    --cr-primary-dark: #1e3a8a;
    --cr-secondary: #64748b;
    --cr-accent: #0891b2;
    --cr-success: #15803d;
    --cr-warning: #ca8a04;
    --cr-danger: #dc2626;
    --cr-bg: #f8fafc;
    --cr-card: #ffffff;
    --cr-text: #0f172a;
    --cr-text-muted: #64748b;
    --cr-border: #e2e8f0;
}

/* ============================================================
   ROOT CONTAINER
   ============================================================ */
#career-root {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--cr-bg);
}

.cr-app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================================
   TOPBAR - UNIFIED
   ============================================================ */
.cr-topbar {
    background: var(--cr-primary);
    color: white;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    z-index: 100;
    position: relative;
    border-bottom: 3px solid var(--cr-primary-dark);
}

.cr-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cr-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.cr-topbar-title {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ============================================================
   LANDING PAGE - HERO CARDS
   ============================================================ */
.cr-hero {
    background: var(--cr-primary);
    color: white;
    padding: 48px 32px;
    text-align: center;
    border-bottom: 4px solid var(--cr-primary-dark);
}

.cr-hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.cr-hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.cr-hero-sub {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

.cr-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.cr-feature-card {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--cr-border);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cr-feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--cr-primary);
}

.cr-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--cr-bg) 0%, #e0f2fe 100%);
    border: 3px solid var(--cr-border);
}

.cr-feature-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cr-text);
    margin: 0 0 10px 0;
}

.cr-feature-card p {
    font-size: 0.95rem;
    color: var(--cr-text-muted);
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.cr-card-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.cr-tag {
    background: var(--cr-bg);
    color: var(--cr-primary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--cr-border);
}

.cr-card-btn {
    background: var(--cr-primary);
    color: white;
    border: 2px solid var(--cr-primary-dark);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cr-card-btn:hover {
    background: var(--cr-primary-dark);
    border-color: var(--cr-primary-dark);
    transform: translateY(-2px);
}

/* ============================================================
   CONSULT LAYOUT - 2 COLUMNS
   ============================================================ */
.cr-consult-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.cr-form-panel {
    background: white;
    border-right: 3px solid var(--cr-border);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cr-result-panel {
    background: var(--cr-bg);
    padding: 24px;
    overflow-y: auto;
}

.cr-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cr-primary);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--cr-border);
}

.cr-form-section {
    background: #f8fafc;
    border: 2px solid var(--cr-border);
    border-radius: 12px;
    padding: 18px;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.cr-select,
.cr-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
    background: white;
    color: var(--cr-text);
}

.cr-select:focus,
.cr-input:focus {
    border-color: var(--cr-primary);
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.1);
}

.cr-score-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.cr-score-input {
    display: flex;
    flex-direction: column;
}

.cr-score-input label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cr-text);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cr-coeff {
    background: var(--cr-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
}

.cr-total-display {
    background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
    border: 3px solid var(--cr-primary);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-top: 16px;
    font-size: 0.95rem;
    color: var(--cr-text);
}

.cr-submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--cr-accent) 0%, #f59e0b 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3);
    margin-top: auto;
}

.cr-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(251, 191, 36, 0.4);
}

/* ============================================================
   SEARCH LAYOUT WITH MAP - REDESIGN
   ============================================================ */
.cr-search-layout {
    position: relative;
}

.cr-search-layout .cr-topbar {
    position: relative;
    z-index: 101;
}

.cr-search-content {
    display: grid;
    grid-template-columns: 580px 1fr;
    gap: 0;
    height: calc(100% - 70px);
    overflow: hidden;
}

.cr-table-side {
    background: white;
    border-right: 3px solid var(--cr-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cr-search-bar {
    padding: 16px;
    background: #f8fafc;
    border-bottom: 2px solid var(--cr-border);
    position: relative;
}

.cr-search-bar i {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cr-text-muted);
}

.cr-search-bar input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
}

.cr-search-bar input:focus {
    border-color: var(--cr-primary);
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.1);
}

.cr-table-wrap {
    flex: 1;
    overflow-y: auto;
}

.cr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cr-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.cr-table thead th {
    background: linear-gradient(135deg, var(--cr-primary) 0%, var(--cr-secondary) 100%);
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 3px solid var(--cr-primary-dark);
}

.cr-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s;
    cursor: pointer;
}

.cr-table tbody tr:hover {
    background: var(--cr-bg);
}

.cr-table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
}

/* ============================================================
   MAP SIDE - FULLSCREEN WITH OVERLAY
   ============================================================ */
.cr-map-side {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cr-map-controls-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.cr-map-controls-overlay > * {
    pointer-events: auto;
}

.cr-map-back-btn {
    background: white;
    border: 3px solid var(--cr-accent);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cr-text);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.4);
}

.cr-map-back-btn:hover {
    background: var(--cr-accent);
    color: white;
    transform: scale(1.05);
}

.cr-map-filters {
    background: white;
    border: 3px solid var(--cr-border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.cr-filter-btn {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cr-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

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

.cr-filter-btn.active {
    background: linear-gradient(135deg, var(--cr-primary) 0%, var(--cr-secondary) 100%);
    border-color: var(--cr-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

#cr-school-map {
    width: 100%;
    height: 100%;
    border: none;
    position: relative;
}

/* ============================================================
   MAP LEGEND - FLOATING BOTTOM LEFT
   ============================================================ */
.cr-map-legend-box {
    background: white;
    border: 3px solid var(--cr-accent);
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    max-width: 220px;
}

.cr-legend-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--cr-text);
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 2px dashed var(--cr-accent);
    padding-bottom: 8px;
}

.cr-legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    font-size: 0.9rem;
    color: var(--cr-text);
    border-radius: 8px;
    margin-bottom: 4px;
}

.cr-legend-item:hover {
    background: var(--cr-bg);
}

.cr-legend-marker {
    font-size: 1.6rem;
    width: 36px;
    text-align: center;
}

/* ============================================================
   SCORE CARD - TOP CENTER
   ============================================================ */
.cr-score-card-map {
    background: white;
    border: 3px solid var(--cr-accent);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: 0 6px 24px rgba(251, 191, 36, 0.4);
    text-align: center;
    min-width: 200px;
}

.cr-score-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cr-text-muted);
    margin-bottom: 6px;
}

.cr-score-card-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--cr-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.cr-score-card-hint {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cr-text);
}

/* ============================================================
   MAP HINT BOX - BOTTOM RIGHT
   ============================================================ */
.cr-map-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border: 3px solid var(--cr-primary);
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 0.9rem;
    color: var(--cr-primary-dark);
    box-shadow: 0 4px 16px rgba(8, 145, 178, 0.3);
    max-width: 350px;
    z-index: 150;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   NEARBY SCHOOLS - FLOATING LEFT
   ============================================================ */
#cr-nearby-schools {
    position: absolute;
    top: 90px;
    left: 20px;
    max-width: 380px;
    z-index: 180;
}

.cr-nearby-box {
    background: white;
    border: 3px solid var(--cr-accent);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.cr-nearby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px dashed var(--cr-accent);
    margin-bottom: 12px;
}

.cr-nearby-header h4 {
    margin: 0;
    color: var(--cr-text);
    font-size: 1.05rem;
    font-weight: 800;
}

.cr-nearby-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--cr-border);
    background: #f8fafc;
    color: var(--cr-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cr-nearby-close:hover {
    background: #fee2e2;
    color: var(--cr-danger);
    border-color: var(--cr-danger);
}

.cr-nearby-box h4 {
    margin: 0 0 16px 0;
    color: var(--cr-text);
    font-size: 1.1rem;
    font-weight: 800;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px dashed var(--cr-accent);
}

/* Direction error panel */
.cr-dir-error-body {
    padding: 24px 20px;
    text-align: center;
}

.cr-dir-external-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--cr-primary);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.cr-dir-external-link:hover {
    background: var(--cr-primary-dark);
    transform: translateY(-1px);
}

.cr-dir-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cr-text);
}

.cr-dir-stats {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.cr-dir-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cr-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.cr-dir-step-content {
    flex: 1;
}

.cr-dir-instruction {
    font-size: 0.9rem;
    color: var(--cr-text);
    line-height: 1.5;
}

.cr-dir-distance {
    font-size: 0.8rem;
    color: var(--cr-text-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* ============================================================
   DIRECTIONS PANEL - REDESIGN
   ============================================================ */
.cr-directions-panel {
    position: absolute;
    top: 90px;
    right: 20px;
    width: 400px;
    max-height: calc(100% - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    border: 3px solid var(--cr-accent);
    z-index: 190;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.cr-dir-header {
    background: linear-gradient(135deg, var(--cr-accent) 0%, #f59e0b 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cr-dir-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.cr-dir-close {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
}

.cr-dir-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.cr-dir-summary {
    padding: 18px 20px;
    background: #fffbeb;
    border-bottom: 3px dashed var(--cr-accent);
}

.cr-dir-endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cr-text);
}

.cr-endpoint-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.cr-dir-arrow {
    text-align: center;
    font-size: 1.8rem;
    margin: 6px 0;
}

.cr-dir-stats-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.cr-dir-stat-card {
    background: white;
    border: 3px solid var(--cr-accent);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cr-stat-icon {
    font-size: 2rem;
}

.cr-stat-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--cr-text);
    line-height: 1.1;
}

.cr-stat-lbl {
    font-size: 0.7rem;
    color: var(--cr-text-muted);
    font-weight: 700;
    text-transform: uppercase;
}

.cr-dir-steps-title {
    padding: 14px 20px;
    background: #f8fafc;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--cr-text);
    border-bottom: 2px solid var(--cr-border);
}

.cr-dir-steps {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: #fafafa;
}

.cr-dir-step {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--cr-border);
    transition: all 0.2s;
}

.cr-dir-step:hover {
    border-color: var(--cr-primary);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.15);
}

.cr-dir-step-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
}

.cr-transit-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.cr-transit-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .cr-cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cr-consult-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .cr-form-panel {
        border-right: none;
        border-bottom: 3px solid var(--cr-border);
        max-height: 50vh;
    }

    .cr-search-content {
        grid-template-columns: 1fr;
        grid-template-rows: 50% 50%;
    }

    .cr-table-side {
        border-right: none;
        border-bottom: 3px solid var(--cr-border);
    }

    .cr-map-controls-overlay {
        flex-direction: column;
        gap: 12px;
    }

    #cr-nearby-schools {
        position: static;
        margin: 16px 0;
        max-width: 100%;
    }

    .cr-directions-panel {
        top: 60px;
        right: 10px;
        left: 10px;
        width: auto;
    }
}

@media (max-width: 768px) {
    .cr-hero {
        padding: 32px 20px;
    }

    .cr-hero-title {
        font-size: 1.8rem;
    }

    .cr-cards-grid {
        padding: 20px;
    }

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

    .cr-search-content {
        grid-template-rows: 60% 40%;
    }
}
