@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #faf8f5; /* Warm, vintage vanilla/cream background */
    --bg-card: #ffffff;
    --border-color: rgba(211, 82, 48, 0.08); /* Terracotta tint */
    --text-primary: #1b2e2b; /* Deep rich forest green/black for headings */
    --text-secondary: #4a5d5a; /* Softer olive/charcoal for body */
    
    --primary-color: #d35230; /* Cozy Terracotta/Clay */
    --primary-grad: linear-gradient(135deg, #e05e3c 0%, #b23f20 100%);
    --primary-glow: rgba(211, 82, 48, 0.08);
    
    --accent-color: #e29b35; /* Warm Mustard Gold */
    --accent-grad: linear-gradient(135deg, #e29b35 0%, #c47e1d 100%);
    
    --success-color: #1a8f68; /* Deep rich green */
    --danger-color: #cb3a51; /* Warm dark red */
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 24px;
    --radius-md: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(211, 82, 48, 0.04) 0px, transparent 40%),
        radial-gradient(at 100% 100%, rgba(226, 155, 53, 0.04) 0px, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Glassmorphism/Card base */
.glass {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(211, 82, 48, 0.02);
}

/* Header & Nav */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 248, 245, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 15px rgba(0,0,0,0.01);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo::before {
    content: '🧦';
    font-size: 1.4rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-color);
    background: var(--primary-glow);
}

.nav-user-badge {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-right: 1.5px solid var(--border-color);
    margin-right: 0.25rem;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.logout-btn:hover {
    color: var(--danger-color);
    background: rgba(244, 63, 94, 0.05);
}

/* Lang Dropdown */
.lang-selector {
    position: relative;
    display: inline-block;
}

.lang-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.lang-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 140px;
    border-radius: var(--radius-md);
    z-index: 10;
    box-shadow: 0 10px 25px rgba(15, 118, 110, 0.08);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border-color);
}

.lang-selector:hover .lang-dropdown {
    display: block;
}

.lang-dropdown a {
    display: block;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    border-radius: 0;
}

.lang-dropdown a:hover {
    background: var(--primary-glow);
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--primary-grad);
    color: white;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-main);
    border-color: rgba(15, 118, 110, 0.2);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Main Container */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #065f46;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #9f1239;
}

@keyframes slideIn {
    from { transform: translateY(-15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Forms Card */
.form-card {
    max-width: 500px;
    margin: 0 auto;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(15, 118, 110, 0.05);
}

.form-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-weight: 500;
    transition: var(--transition-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.form-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.listing-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.listing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.2);
}

.listing-img-placeholder {
    height: 200px;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.03) 0%, rgba(249, 115, 22, 0.03) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.listing-img {
    height: 200px;
    width: 100%;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.listing-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.listing-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--accent-color);
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.listing-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.listing-location {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.listing-btn {
    width: 100%;
    margin-top: 1rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4.5rem 1rem 3rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.25rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.hero h1 span {
    background: var(--primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.hero-ctas {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Homepage Grids & Responsive Banners */
.features-grid {
    max-width: 900px;
    margin: 4rem auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    text-align: center;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.trust-banner {
    max-width: 950px;
    margin: 6rem auto;
    padding: 3.5rem;
    border-radius: 24px;
    border: 1.5px solid var(--accent-color);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
    text-align: left;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.04);
}

.search-form-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-form-group {
    flex: 1;
    min-width: 200px;
}

/* Chat Layout */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    height: calc(100vh - 200px);
    max-height: 700px;
}

.inbox-list {
    border-radius: var(--radius-lg);
    overflow-y: auto;
    padding: 1rem;
}

.inbox-item {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    display: block;
    background: #ffffff;
}

.inbox-item:hover, .inbox-item.active {
    background: var(--primary-glow);
    border-color: var(--primary-color);
}

.inbox-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.inbox-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chat-box {
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #fdfdfd;
}

.message-bubble {
    max-width: 65%;
    padding: 0.85rem 1.25rem;
    border-radius: 16px;
    line-height: 1.5;
    position: relative;
    font-weight: 500;
}

.message-sent {
    background: var(--primary-grad);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

.message-received {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    text-align: right;
}

.chat-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
}

.chat-input-form {
    display: flex;
    gap: 1rem;
}

/* Listing Details */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

.detail-gallery {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.detail-gallery img {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
}

.detail-card {
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    background: #ffffff;
}

.detail-section-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--primary-glow);
    padding-bottom: 0.5rem;
    color: var(--primary-color);
}

.detail-meta-list {
    list-style: none;
}

.detail-meta-list li {
    padding: 0.75rem 0;
    border-bottom: 1px dotted var(--border-color);
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.detail-meta-label {
    color: var(--text-secondary);
}

/* Premium Upgrade screen */
.upgrade-card {
    max-width: 600px;
    margin: 2rem auto;
    text-align: center;
    padding: 4rem 2rem;
    border-radius: 28px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 15px 40px rgba(13, 148, 136, 0.08);
    background: #ffffff;
}

.upgrade-price {
    font-size: 4.25rem;
    font-weight: 900;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1.5rem 0;
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 2.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: auto;
    background: #ffffff;
}

/* Full Width Banner */
.full-width-banner {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: 3.5rem;
    margin-bottom: 3.5rem;
    overflow: hidden;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.full-width-banner img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
}

/* Pagination Styling */
.pagination {
    display: flex;
    list-style: none;
    padding-left: 0;
    gap: 0.5rem;
    align-items: center;
}

.page-item {
    display: inline-block;
}

.page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.page-item .page-link:hover {
    color: white;
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.15);
}

.page-item.active .page-link {
    color: white;
    background: var(--primary-grad);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

.page-item.disabled .page-link {
    color: var(--text-secondary);
    opacity: 0.5;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.02);
}

/* Unread Badge */
.unread-badge {
    background-color: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 5px rgba(244, 63, 94, 0.3);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (Tablets & Smartphones)
   ========================================================================== */

/* 1. Large Tablets & Small Laptops (< 992px) */
@media (max-width: 992px) {
    .nav-container {
        padding: 0.75rem 1.25rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .detail-card {
        padding: 1.5rem;
    }

    .chat-container {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    .inbox-list {
        max-height: 240px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}

/* 2. Smartphones & Small Tablets (< 768px) */
@media (max-width: 768px) {
    main {
        padding: 1.25rem 1rem;
    }

    /* Navigation header responsiveness */
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    nav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links {
        display: flex;
        gap: 0.35rem;
        white-space: nowrap;
        padding-bottom: 0.25rem;
    }

    .nav-links a, .logout-btn {
        font-size: 0.825rem;
        padding: 0.35rem 0.6rem;
    }

    .nav-user-badge {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }

    /* Hero section responsiveness */
    .hero {
        padding: 2rem 0.5rem 1.5rem;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.25;
        letter-spacing: -0.3px;
        margin-bottom: 1rem;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .hero p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }

    .hero-ctas {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .hero-ctas .btn {
        width: 100%;
    }

    /* Listings grid */
    .listings-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* Form card */
    .form-card {
        padding: 1.5rem 1.25rem;
        border-radius: var(--radius-md);
        box-shadow: none;
    }

    .form-title {
        font-size: 1.4rem;
    }

    /* Stack grid form columns (e.g., City / University selectors) */
    .form-card div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Listing gallery carousel on mobile */
    .carousel-slide {
        height: 280px !important;
    }

    .carousel-thumb {
        height: 50px !important;
        width: 65px !important;
    }

    /* Full width banner image */
    .full-width-banner img {
        height: 220px;
    }

    /* Upgrade pricing card */
    .upgrade-card {
        padding: 2.5rem 1.25rem;
        border-radius: var(--radius-lg);
    }

    .upgrade-price {
        font-size: 3rem;
    }

    /* Homepage grids responsiveness */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin: 2.5rem auto;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .trust-banner {
        grid-template-columns: 1fr;
        padding: 1.75rem 1.25rem;
        gap: 1.5rem;
        margin: 3rem auto;
        text-align: center;
    }

    .trust-banner ul {
        text-align: left;
    }

    .search-form-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form-group {
        width: 100%;
    }

    .section-heading {
        font-size: 1.45rem !important;
        margin-bottom: 1.75rem !important;
    }

    /* Messaging chat bubbles */
    .message-bubble {
        max-width: 88%;
        font-size: 0.9rem;
    }

    .chat-header, .chat-footer {
        padding: 1rem;
    }

    .chat-body {
        padding: 1rem;
    }

    .chat-input-form {
        flex-direction: column;
        gap: 0.5rem;
    }

    .chat-input-form button {
        width: 100%;
    }
}

/* 3. Small Mobile Devices (< 480px) */
@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }

    .hero h1 {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 0.875rem;
        line-height: 1.45;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .detail-section-title {
        font-size: 1.1rem;
    }

    .listing-title {
        font-size: 1.05rem;
    }
}
