/* Schools Page Stylesheet */

:root {
    --royal-blue: #1e3a8a;
    --royal-red: #ef4444;
    --royal-gold: #eab308;
    --map-bg: #f8fafc;
    --map-stroke: #ffffff;
    --map-fill-default: #cbd5e1;
    --map-hover-fill: #3b82f6;
    --map-active-fill: #1d4ed8;
}

body {
    background: radial-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Page Hero Header */
.schools-hero {
    padding: 140px 0 40px;
    background: transparent;
}

.page-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

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

/* Main Layout Grid */
.map-section {
    padding: 20px 0 80px;
}

.main-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.map-container {
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 780px;
}

.region-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: rgba(15, 23, 42, 0.05);
    padding: 6px;
    border-radius: 50px;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.region-btn {
    border: none;
    background: transparent;
    padding: 8px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.region-btn:hover {
    color: var(--royal-blue);
    background: rgba(255, 255, 255, 0.6);
}

.region-btn.active {
    background: var(--royal-blue);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.svg-wrapper {
    width: 100%;
    max-width: 650px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#taiwan-svg {
    width: 100%;
    height: auto;
    max-height: 700px;
    filter: drop-shadow(0 15px 25px rgba(15, 23, 42, 0.08));
    transition: viewBox 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* SVG Path Interactivity */
#taiwan-svg path {
    fill: var(--map-fill-default);
    stroke: var(--map-stroke);
    stroke-width: 2px;
    stroke-linejoin: round;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SVG Regional Color Fills */
#taiwan-svg #region-north path {
    fill: #a5f3fc; /* Soft Blue */
}
#taiwan-svg #region-central path {
    fill: #bbf7d0; /* Soft Green */
}
#taiwan-svg #region-south path {
    fill: #fef08a; /* Soft Yellow */
}
#taiwan-svg #region-east path {
    fill: #e9d5ff; /* Soft Purple */
}

/* Hide outer islands */
#lienchiang-county,
#penghu-county,
#kinmen-county {
    display: none !important;
}

/* Hovering on county path */
#taiwan-svg path:hover {
    fill: var(--map-hover-fill) !important;
    stroke: #ffffff;
    stroke-width: 3px;
    filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.4));
    transform: translateY(-2px);
    z-index: 10;
}

/* Selected path state */
#taiwan-svg path.selected-county {
    fill: var(--map-active-fill) !important;
    stroke: var(--royal-gold) !important;
    stroke-width: 4px !important;
    filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.7)) !important;
}

/* Styling for filtered region states */
#taiwan-svg.filtered-map .region-group {
    opacity: 0.15;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#taiwan-svg.filtered-map .region-group.active-region {
    opacity: 1;
    pointer-events: auto;
}

#taiwan-svg.filtered-map .region-group.active-region path {
    fill: #94a3b8; /* Make the active region counties stand out slightly more from default */
}

.list-container {
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: 780px;
}

.search-box-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    flex: 1;
}

.nearby-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--royal-blue);
    color: var(--white);
    border: none;
    border-radius: 14px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

.nearby-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.25);
    background: var(--map-hover-fill);
}

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

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

#school-search {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

#school-search:focus {
    outline: none;
    border-color: var(--royal-blue);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    padding-bottom: 12px;
}

.list-header h3 {
    font-size: 1.4rem;
    color: var(--royal-blue);
}

.count-badge {
    background: rgba(30, 58, 138, 0.1);
    color: var(--royal-blue);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Scrollable School List */
.school-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom Scrollbar for School List */
.school-list::-webkit-scrollbar {
    width: 6px;
}

.school-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.02);
    border-radius: 4px;
}

.school-list::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 4px;
}

.school-list::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.3);
}

/* School Cards styling */
.school-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.school-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--map-hover-fill);
}

.school-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-brand);
    border-radius: 4px 0 0 4px;
}

.school-card h4 {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 10px;
    font-weight: 700;
}

.school-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
}

.school-info-item i {
    color: var(--royal-blue);
    width: 16px;
    text-align: center;
}

.school-info-item a {
    color: var(--text-main);
    transition: color 0.2s ease;
}

.school-info-item a:hover {
    color: var(--map-hover-fill);
    text-decoration: underline;
}

.school-card-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.action-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.action-btn-primary {
    background: var(--royal-blue);
    color: var(--white);
}

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

.action-btn-secondary {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(15, 23, 42, 0.1);
}

.action-btn-secondary:hover {
    background: rgba(15, 23, 42, 0.1);
    color: var(--dark);
}

/* Empty/Default States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    opacity: 0.4;
    color: var(--royal-blue);
}

.empty-state p {
    font-size: 1rem;
    font-weight: 500;
}

/* Responsive Adaptation */
@media (max-width: 992px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .list-container, .map-container {
        height: auto;
        min-height: auto;
    }
    
    .school-list {
        max-height: 480px;
    }
}

@media (max-width: 600px) {
    .schools-hero {
        padding: 120px 0 20px;
    }
    
    .page-title {
        font-size: 2.2rem;
    }
    
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(30, 58, 138, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(30, 58, 138, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 58, 138, 0); }
}

.school-card.nearest-highlight {
    border-color: var(--royal-blue);
    background: rgba(30, 58, 138, 0.03);
    animation: pulse-highlight 2s infinite;
}

#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}
