/* ============================================================================
   Subledu Shared Styles
   ============================================================================ */

@font-face {
    font-family: 'Airbnb Cereal';
    src: url('/fonts/AirbnbCereal_W_Bk.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Airbnb Cereal';
    src: url('/fonts/AirbnbCereal_W_Lt.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Airbnb Cereal';
    src: url('/fonts/AirbnbCereal_W_Md.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

:root {
    --primary: #082464;
    --primary-dark: #061b4d;
    --primary-light: #e8edf7;
    --text: #222222;
    --text-light: #717171;
    --border: #DDDDDD;
    --bg: #f6f6f6;
    --white: #ffffff;
    --red: #e53e3e;
    --green: #38a169;
    --yellow: #d69e2e;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Airbnb Cereal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

/* ---- Nav ---- */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 18px;
    color: var(--primary);
}

.nav-logo img { height: 28px; }

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

.nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.nav-links a:hover { background: var(--bg); text-decoration: none; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

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

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

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

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(8,36,100,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-body { padding: 16px; }

/* ---- Listing Card ---- */
.listing-card {
    position: relative;
    cursor: pointer;
}

.listing-card .card-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #e5e5e5;
}

.listing-card .card-info { padding: 12px 0 0; }

.listing-card .location-line {
    font-weight: 500;
    font-size: 15px;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-card .school-line {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 2px;
}

.listing-card .dates-line {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 4px;
}

.listing-card .price-line {
    font-weight: 500;
    font-size: 15px;
}

.listing-card .price-line span {
    font-weight: 400;
    color: var(--text-light);
}

/* Favorite heart */
.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.85);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    z-index: 2;
    transition: transform 0.15s;
}
.favorite-btn:hover { transform: scale(1.1); }
.favorite-btn.active { color: var(--red); }

/* ---- Grid ---- */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 24px;
}

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

/* ---- Auth Pages ---- */
.auth-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    font-size: 24px;
    font-weight: 500;
    margin: 0 0 8px;
    color: var(--primary);
}

.auth-card .subtitle {
    font-size: 15px;
    color: var(--text-light);
    margin: 0 0 24px;
}

.auth-card .footer-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

/* ---- Error/Success ---- */
.error-message {
    background: #fef2f2;
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.success-message {
    background: #f0fff4;
    color: var(--green);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

/* ---- School Filter Pills ---- */
.school-filter {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.school-pill {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.school-pill:hover, .school-pill.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ---- Image Carousel ---- */
.carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
}

.carousel-track img {
    width: 100%;
    flex-shrink: 0;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-btn:hover { background: white; }

.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.carousel-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
}
.carousel-dots span.active { background: white; }

/* ---- Lease Calculator ---- */
.lease-calc {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.lease-calc h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 12px;
    color: var(--primary);
}

.lease-calc .calc-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(8,36,100,0.1);
}

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

.lease-calc .calc-row .label { color: var(--text-light); }
.lease-calc .calc-row .value { font-weight: 500; }

.lease-calc .price-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
}
.price-badge.below { background: #c6f6d5; color: #22543d; }
.price-badge.above { background: #fed7d7; color: #9b2c2c; }
.price-badge.avg { background: #fefcbf; color: #744210; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 24px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Badge ---- */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-green { background: #c6f6d5; color: #22543d; }
.badge-red { background: #fed7d7; color: #9b2c2c; }
.badge-yellow { background: #fefcbf; color: #744210; }
.badge-blue { background: var(--primary-light); color: var(--primary); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .nav { padding: 0 16px; }
    .listings-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding: 16px; }
    .auth-card { padding: 24px; }
    .container, .container-sm, .container-md { padding: 0 16px; }
}

@media (max-width: 480px) {
    .listings-grid { grid-template-columns: 1fr; }
    .nav-links a span.desktop-only { display: none; }
}

/* ---- Loading ---- */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state h3 { font-size: 18px; color: var(--text); margin: 0 0 8px; }
.empty-state p { font-size: 15px; margin: 0 0 20px; }
