/* ===========================================
   Apple-Inspired Design System
   Clean, Minimal, Premium
   =========================================== */

/* CSS Variables - Elegant Matte Purple Palette */
:root {
    /* Backgrounds - Soft Matte Purple */
    --bg-primary: #faf8ff;
    --bg-secondary: #f3f0ff;
    --bg-tertiary: #ede9fe;
    --bg-card: #ffffff;

    /* Text Colors - Deep Purple Tones */
    --text-primary: #1e1b4b;
    --text-secondary: #4c4575;
    --text-tertiary: #8b83a8;
    --text-link: #7c3aed;

    /* Accent Colors - Matte Purple */
    --accent-primary: #7c3aed;
    --accent-primary-hover: #6d28d9;
    --accent-secondary: #a78bfa;
    --accent-green: #10b981;
    --accent-green-hover: #059669;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;

    /* Borders & Shadows - Purple-tinted */
    --border-color: #d4d0e8;
    --border-light: #e9e5f5;
    --shadow-sm: 0 1px 3px rgba(30, 27, 75, 0.05);
    --shadow-md: 0 4px 12px rgba(30, 27, 75, 0.08);
    --shadow-lg: 0 8px 28px rgba(30, 27, 75, 0.12);
    --shadow-card: 0 2px 8px rgba(30, 27, 75, 0.04), 0 8px 32px rgba(30, 27, 75, 0.08);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 980px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 17px;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.022em;
    color: var(--text-primary);
}

h1 { font-size: 48px; font-weight: 700; }
h2 { font-size: 32px; font-weight: 600; }
h3 { font-size: 24px; font-weight: 600; }
h4 { font-size: 19px; font-weight: 600; }

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Container */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

@media (min-width: 769px) {
    .container {
        padding: var(--space-2xl) var(--space-2xl);
    }
}

/* ===========================================
   Navigation
   =========================================== */
.navbar {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-content h1 {
    font-size: 21px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-right span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===========================================
   Buttons
   =========================================== */
.btn-primary,
.btn-secondary,
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 17px;
    font-weight: 500;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.02);
}

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

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: var(--accent-green-hover);
    transform: scale(1.02);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===========================================
   Auth Card (Login/Signup)
   =========================================== */
.auth-card {
    max-width: 400px;
    margin: 80px auto;
    background: var(--bg-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}

.auth-card h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: var(--space-sm);
}

.auth-card h2 {
    font-size: 21px;
    margin-bottom: var(--space-lg);
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xl);
    font-size: 17px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-form input {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 17px;
    background: var(--bg-primary);
    transition: all var(--transition-fast);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.auth-form input::placeholder {
    color: var(--text-tertiary);
}

.switch-auth {
    text-align: center;
    margin-top: var(--space-md);
    font-size: 14px;
    color: var(--text-tertiary);
}

.switch-auth a {
    color: var(--accent-primary);
    font-weight: 500;
}

/* ===========================================
   Sections
   =========================================== */
.section {
    margin-bottom: var(--space-2xl);
}

.section:first-child {
    margin-top: 0;
}

.section h2 {
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-size: 28px;
    font-weight: 600;
}

/* ===========================================
   Cities Grid
   =========================================== */
.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.city-card {
    background: var(--bg-card);
    padding: var(--space-xl) var(--space-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.city-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.city-card h3 {
    color: var(--text-primary);
    font-size: 21px;
    margin-bottom: var(--space-xs);
}

.city-card p {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ===========================================
   Search & Filter Bar
   =========================================== */
.search-filter-bar {
    background: var(--bg-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-light);
}

.search-box {
    margin-bottom: var(--space-md);
}

.search-box input {
    width: 100%;
    padding: 14px 18px;
    padding-left: 48px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 17px;
    background: var(--bg-secondary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%2386868b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.filter-controls {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.filter-controls select {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    padding-right: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2386868b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* ===========================================
   Hotels Grid
   =========================================== */
.hotels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.hotel-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.hotel-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.hotel-header {
    padding: var(--space-lg);
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: white;
}

.hotel-header h3 {
    color: white;
    font-size: 19px;
    margin-bottom: var(--space-xs);
}

.hotel-rating {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 13px;
}

.hotel-body {
    padding: var(--space-lg);
}

.hotel-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-size: 15px;
    line-height: 1.5;
}

.hotel-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.amenity-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
}

.hotel-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.price-tag {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.price-range {
    font-size: 12px;
    color: var(--text-tertiary);
}

.negotiate-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.negotiate-btn:hover {
    background: var(--accent-primary-hover);
}

/* ===========================================
   Booking Details Card
   =========================================== */
.booking-details-card {
    background: var(--bg-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.booking-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.input-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.input-group input,
.input-group select {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 17px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2386868b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ===========================================
   Negotiation Panel
   =========================================== */
.negotiation-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid var(--border-light);
}

.negotiation-card h2 {
    font-size: 24px;
    margin-bottom: var(--space-lg);
}

.negotiation-status {
    background: var(--bg-secondary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.negotiation-status p {
    font-size: 15px;
    color: var(--text-secondary);
}

.negotiation-status strong {
    color: var(--text-primary);
}

.messages-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.message {
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.message.system {
    background: #f0f5ff;
    border-left: 3px solid var(--accent-primary);
}

.message.ai {
    background: #f0fdf4;
    border-left: 3px solid var(--accent-green);
}

.message.hotel {
    background: #fffbeb;
    border-left: 3px solid var(--accent-orange);
}

.message-sender {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.message-text {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 15px;
}

.message-offer {
    margin-top: var(--space-sm);
    font-weight: 600;
    color: var(--accent-primary);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.typing-indicator .sender {
    font-weight: 600;
    margin-right: var(--space-sm);
    color: var(--text-tertiary);
    font-size: 14px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Waiting Message */
.waiting-message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    margin: var(--space-md) 0;
    background: #f0f5ff;
    border-radius: var(--radius-md);
    color: var(--accent-primary);
    font-weight: 500;
    gap: var(--space-sm);
}

.waiting-message .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 113, 227, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Final Offer */
.final-offer {
    background: var(--text-primary);
    color: white;
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    text-align: center;
}

.final-offer h3 {
    color: white;
    font-size: 21px;
    margin-bottom: var(--space-md);
}

.final-offer .price {
    font-size: 56px;
    font-weight: 700;
    margin: var(--space-lg) 0;
    letter-spacing: -0.02em;
    color: white;
}

.final-offer .savings {
    font-size: 17px;
    margin-bottom: var(--space-xl);
    opacity: 0.9;
    color: #a5f3fc;
}

.final-offer button {
    margin: 0 var(--space-sm);
}

/* ===========================================
   Success Card
   =========================================== */
.success-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    border: 1px solid var(--border-light);
}

.success-card h2 {
    color: var(--accent-green);
    font-size: 28px;
    margin-bottom: var(--space-lg);
}

.success-card p {
    margin-bottom: var(--space-sm);
}

/* ===========================================
   Empty & Error States
   =========================================== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--text-tertiary);
    margin-bottom: var(--space-lg);
}

.error-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    background: #fef2f2;
    border-radius: var(--radius-lg);
    border: 1px solid #fecaca;
}

.error-state h3 {
    color: var(--accent-red);
    margin-bottom: var(--space-sm);
}

.error-state p {
    color: #991b1b;
}

.error-message {
    background: #fef2f2;
    color: var(--accent-red);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    margin-top: var(--space-md);
    text-align: center;
    font-size: 15px;
}

/* Loading Skeleton */
.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.skeleton-card {
    height: 350px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-lg);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===========================================
   Utilities
   =========================================== */
.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-tertiary);
    font-size: 17px;
}

/* ===========================================
   Booking Method Choice Tiles
   =========================================== */

/* Container class for booking method (removes hotels-grid styles) */
.booking-method-container {
    display: block !important;
}

.booking-method-choice {
    width: 100%;
    max-width: 100%;
    display: block;
}

.booking-method-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 20px;
    padding: 10px 0;
    width: 100%;
}

/* When there are 3 cards (demo + 2 others), use 3 columns */
.booking-method-tiles.three-cards {
    grid-template-columns: repeat(3, 1fr);
}

.booking-method-tiles .method-card {
    width: 100%;
    min-height: auto;
}

@media (max-width: 900px) {
    .booking-method-tiles {
        grid-template-columns: repeat(2, 1fr);
    }

    .booking-method-tiles.three-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .booking-method-tiles.three-cards .method-card:last-child {
        grid-column: span 2;
        max-width: 50%;
        justify-self: center;
    }
}

@media (max-width: 600px) {
    .booking-method-tiles,
    .booking-method-tiles.three-cards {
        grid-template-columns: 1fr;
    }

    .booking-method-tiles.three-cards .method-card:last-child {
        grid-column: span 1;
        max-width: 100%;
    }
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    h1 { font-size: 32px; }
    h2 { font-size: 24px; }
    h3 { font-size: 19px; }

    .container {
        padding: var(--space-lg) var(--space-md);
    }

    .section {
        margin-bottom: var(--space-xl);
    }

    .cities-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .hotels-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        margin: var(--space-xl) var(--space-md);
        padding: var(--space-lg);
    }

    .booking-inputs {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        flex-direction: column;
    }

    .filter-controls select {
        width: 100%;
        min-width: 100%;
    }

    .messages-container {
        max-height: 250px;
    }

    .final-offer {
        padding: var(--space-lg);
    }

    .final-offer .price {
        font-size: 40px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-success {
        width: 100%;
        margin: var(--space-xs) 0;
    }
}
