/* Style System for School Search Website */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent-color: #06b6d4;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(circle at 10% 20%, rgba(243, 246, 255, 1) 0%, rgba(248, 250, 252, 1) 90%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header Section */
header {
    padding: 60px 0 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 150px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    z-index: -1;
}

.logo-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(37, 99, 235, 0.2));
    animation: bounce 2s infinite ease-in-out;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Bar Wrapper */
.search-wrapper {
    max-width: 680px;
    margin: 0 auto 48px;
    position: sticky;
    top: 20px;
    z-index: 100;
}

.search-container {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 8px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
}

.search-container:focus-within {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.12), 0 10px 10px -5px rgba(37, 99, 235, 0.04);
    transform: translateY(-2px);
}

.search-icon {
    padding: 0 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.search-icon svg {
    width: 22px;
    height: 22px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 4px;
    font-size: 1.1rem;
    font-family: inherit;
    color: var(--text-main);
    width: 100%;
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.clear-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.clear-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.search-stats {
    text-align: center;
    margin-top: -30px;
    margin-bottom: 40px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-stats span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 32px;
}

/* School Card */
.school-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    position: relative;
}

.school-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(37, 99, 235, 0.15);
}

/* Image Container */
.card-img-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #f1f5f9;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.card-img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Maintain image proportions nicely */
    background: #fdfdfd;
    padding: 10px;
    transition: transform 0.5s ease;
}

.school-card:hover .card-img-container img {
    transform: scale(1.03);
}

/* Placeholder Style */
.image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-muted);
    padding: 20px;
    text-align: center;
}

.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

.placeholder-text {
    font-size: 0.85rem;
}

/* Card Content */
.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.school-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.4;
    min-height: 2.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.school-details {
    margin-bottom: 24px;
    flex: 1;
}

.detail-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-row svg {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.detail-label {
    font-weight: 500;
    color: var(--text-main);
    margin-right: 4px;
}

/* Badges */
.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
}

.badge-smis {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.badge-location {
    background-color: #f0fdf4;
    color: #166534;
}

/* Download Button Container */
.card-actions {
    margin-top: auto;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: var(--transition-smooth);
    border: none;
    cursor: pointer;
}

.btn-download:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.btn-download:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

.btn-download svg {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.btn-download:hover svg {
    transform: translateY(2px);
}

/* No Results Section */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

/* Footer styling */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
}

/* Animations */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* Media Queries */
@media (max-width: 768px) {
    header {
        padding: 40px 0 24px;
    }
    h1 {
        font-size: 1.75rem;
    }
    .subtitle {
        font-size: 0.95rem;
    }
    .search-wrapper {
        margin-bottom: 32px;
    }
    .results-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .school-card:hover {
        transform: none; /* Disable lift on mobile for better scrolling */
    }
}
