/**
 * Guest Portal CSS - Enterprise Edition
 * Clean, professional design for room upgrade and add-ons portal
 * Mobile-first responsive design
 * Dynamic hotel branding support
 */

/* ========================================
   CSS Variables - Dynamically set from hotel settings
   ======================================== */
:root {
    /* Hotel brand colors - will be overridden by inline styles from DB */
    --hotel-primary-color: #70D3DC;
    --hotel-background-color: #F8F9FA;
    --hotel-secondary-color: #6C757D;

    /* Fixed colors */
    --white: #FFFFFF;
    --black: #000000;
    --light-gray: #F5F5F5;
    --medium-gray: #E0E0E0;
    --dark-gray: #333333;
    --text-color: #333333;
    --text-muted: #6C757D;

    /* Functional colors */
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;

    /* Layout */
    --header-height: 80px;
    --hero-height: min(30vh, 280px);
    --max-width: 1200px;
    --border-radius: 8px;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 4px 20px rgba(0,0,0,0.12);

    /* Transitions */
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--hotel-background-color);
    min-height: 100vh;
}

html {
    scroll-behavior: smooth;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   Header with Hero Image
   ======================================== */
.portal-header {
    position: relative;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0 20px;
}

/* Hero Image Section */
.hero-section {
    position: relative;
    height: var(--hero-height);
    background: linear-gradient(135deg, var(--hotel-primary-color) 0%, var(--hotel-secondary-color) 100%);
    overflow: hidden;
    border-radius: var(--border-radius);
    margin: 20px auto;
    max-width: calc(var(--max-width) - 40px);
    box-shadow: var(--card-shadow);
}

.hero-section.has-image {
    background: none;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.5));
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotel-logo-container {
    text-align: center;
    padding: 20px;
}

.hotel-logo {
    max-height: 120px;
    max-width: 300px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.hotel-name {
    font-size: 32px;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ========================================
   Navigation Tabs
   ======================================== */
.portal-nav {
    background: var(--white);
    border-bottom: 1px solid var(--medium-gray);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-tabs-portal {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-tab {
    padding: 16px 32px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.nav-tab:hover {
    color: var(--hotel-primary-color);
    background: rgba(0,0,0,0.02);
}

.nav-tab.active {
    color: var(--hotel-primary-color);
    border-bottom-color: var(--hotel-primary-color);
}

/* ========================================
   Main Content
   ======================================== */
.portal-main {
    padding: 24px 0;
    min-height: calc(100vh - var(--header-height) - 200px);
}

/* ========================================
   Welcome Section
   ======================================== */
.welcome-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 24px 30px;
    margin-bottom: 30px;
}

.welcome-message {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
    text-align: center;
}

.guest-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.current-room-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--medium-gray);
}

.current-room-section h5 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: center;
}

.current-room-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 8px;
}

.current-reservation-total {
    font-size: 15px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 6px;
}

.current-reservation-total strong {
    color: var(--text-color);
}

.price-sublabel {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.tier-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-base {
    background: #6c757d;
    color: white;
}

.tier-silver {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: white;
}

.tier-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
}

.tier-diamond {
    background: linear-gradient(135deg, #B9F2FF 0%, #70D3DC 100%);
    color: white;
}

/* ========================================
   Guest Summary Section (Collapsible)
   ======================================== */
.guest-summary-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

/* Toggle bar */
.summary-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 24px;
    background: var(--white);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
}

.summary-toggle:hover {
    background: var(--light-gray);
}

.summary-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-toggle-left > i {
    color: var(--hotel-primary-color);
    font-size: 18px;
}

.summary-toggle-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.summary-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--hotel-primary-color);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.summary-chevron {
    font-size: 16px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

/* Expanded state */
.guest-summary-section:not(.collapsed) .summary-chevron {
    transform: rotate(180deg);
}

/* Collapsible body */
.summary-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 24px 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.guest-summary-section.collapsed .summary-items {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
}

.guest-summary-section:not(.collapsed) .summary-items {
    padding: 4px 24px 20px;
    overflow-y: auto;
}

/* Summary items (unchanged layout) */
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--light-gray);
    border-radius: 6px;
}

.summary-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
}

.summary-item-type {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-item-cost {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
}

.summary-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-confirmed {
    background: #d4edda;
    color: #155724;
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-declined {
    background: #f8d7da;
    color: #721c24;
}

@media (max-width: 480px) {
    .summary-toggle {
        padding: 12px 16px;
    }

    .summary-items {
        padding: 0 16px 16px;
    }

    .guest-summary-section:not(.collapsed) .summary-items {
        padding: 4px 16px 16px;
    }

    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .summary-item-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========================================
   Pending Approval Button
   ======================================== */
.btn-add.btn-pending-approval {
    background-color: #f0ad4e;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.85;
}

.btn-add.btn-pending-approval:hover {
    background-color: #f0ad4e;
    filter: none;
    transform: none;
    box-shadow: none;
}

/* ========================================
   Section Headings
   ======================================== */
.section-header {
    margin-bottom: 30px;
}

.section-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 15px;
    color: var(--text-muted);
}

/* ========================================
   Room Cards Grid
   ======================================== */
.room-cards-grid,
.addon-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

/* ========================================
   Card Styles
   ======================================== */
.room-card,
.addon-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition-normal);
    /* Flexbox for equal height cards and aligned buttons */
    display: flex;
    flex-direction: column;
    height: 100%;
}

.room-card:hover,
.addon-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

/* Card Image */
.card-image-container {
    position: relative;
    height: 240px;
    background: var(--light-gray);
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.room-photo-link {
    display: block;
    height: 100%;
    cursor: zoom-in;
}

.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--medium-gray) 0%, var(--light-gray) 100%);
    color: var(--text-muted);
    font-size: 48px;
}

/* Carousel Controls */
.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 2;
}

.carousel-control:hover {
    background: rgba(0,0,0,0.7);
}

.carousel-control-prev {
    left: 10px;
}

.carousel-control-next {
    right: 10px;
}

/* Card Body */
.card-body {
    padding: 24px;
    /* Flexbox to push pricing section to bottom */
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-header-section {
    margin-bottom: 16px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
}

.card-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Room Details (Square Feet & Occupancy) */
.room-details-section {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.room-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.room-detail i {
    font-size: 16px;
    color: var(--hotel-primary-color);
    opacity: 0.8;
}

/* Amenities */
.amenities-section {
    margin-bottom: 20px;
}

.amenities-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.amenity-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.amenity-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--light-gray);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-color);
}

.amenity-tag i {
    color: var(--success-color);
    font-size: 11px;
}

/* Pricing Section */
.pricing-section {
    border-top: 1px solid var(--medium-gray);
    padding-top: 20px;
    margin-top: auto; /* Push to bottom of card for alignment */
}

.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 16px;
}

.price-item {
    text-align: center;
}

.price-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

.price-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--hotel-primary-color);
}

.price-amount.total {
    font-size: 26px;
}

/* Availability Warning */
.availability-warning {
    background: #FFF3CD;
    border-left: 3px solid var(--warning-color);
    color: #856404;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.availability-warning i {
    font-size: 16px;
}

/* CTA Buttons */
.btn-request,
.btn-add {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    background-color: var(--hotel-primary-color);
    border: none;
    border-radius: var(--border-radius);
    color: var(--white);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-request:hover,
.btn-add:hover {
    background-color: var(--hotel-primary-color);
    filter: brightness(0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-request i,
.btn-add i {
    font-size: 18px;
}

/* Already Added Button (Disabled State) */
.btn-add.btn-already-added {
    background-color: #6c757d;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-add.btn-already-added:hover {
    background-color: #6c757d;
    filter: none;
    transform: none;
    box-shadow: none;
}

/* ========================================
   Sections
   ======================================== */
.upgrades-section,
.addons-section {
    scroll-margin-top: 80px;
    padding-top: 20px;
}

/* No Items Message */
.no-items-message {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 60px 30px;
    text-align: center;
}

.no-items-icon {
    font-size: 64px;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 20px;
}

.no-items-message h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.no-items-message p {
    font-size: 15px;
    color: var(--text-muted);
}

/* ========================================
   Error States
   ======================================== */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 40px 20px;
}

.error-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 60px 40px;
    max-width: 500px;
    text-align: center;
}

.error-icon {
    font-size: 64px;
    color: var(--danger-color);
    margin-bottom: 24px;
}

.error-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 16px;
}

.error-message {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 12px;
}

.error-card .text-muted {
    color: var(--text-muted);
    font-size: 14px;
}

.btn-primary {
    background-color: var(--hotel-primary-color);
    color: var(--white);
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    filter: brightness(0.9);
}

/* ========================================
   Modal Styles
   ======================================== */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: var(--light-gray);
    border-bottom: 1px solid var(--medium-gray);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 20px 24px;
}

.modal-title {
    font-weight: 600;
    font-size: 20px;
    color: var(--text-color);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--medium-gray);
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    padding: 10px 20px;
    min-height: 42px;
}

.btn-secondary {
    background: var(--medium-gray);
    color: var(--text-color);
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
}

/* ========================================
   Footer
   ======================================== */
.portal-footer {
    background: var(--white);
    border-top: 1px solid var(--medium-gray);
    text-align: center;
    padding: 24px 0;
    margin-top: 60px;
}

.portal-footer p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .hero-section {
        height: min(35vh, 300px);
        margin: 12px;
        max-width: calc(100% - 24px);
    }

    .portal-header {
        padding: 0 12px;
    }

    .hotel-logo {
        max-height: 80px;
        max-width: 200px;
    }

    .hotel-name {
        font-size: 24px;
    }

    .welcome-message {
        font-size: 20px;
    }

    .guest-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .nav-tab {
        padding: 12px 20px;
        font-size: 14px;
    }

    .section-title {
        font-size: 22px;
    }

    .room-cards-grid,
    .addon-cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .card-image-container {
        height: 200px;
    }

    .price-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .portal-main {
        padding: 24px 0;
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: min(30vh, 250px);
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    .portal-header {
        padding: 0 8px;
    }

    .hotel-logo {
        max-height: 60px;
    }

    .hotel-name {
        font-size: 20px;
    }

    .nav-tabs-portal {
        gap: 0;
    }

    .nav-tab {
        padding: 10px 16px;
        font-size: 13px;
    }

    .guest-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px 16px;
    }

    .welcome-section {
        padding: 20px;
    }

    .card-body {
        padding: 20px;
    }

    .card-title {
        font-size: 18px;
    }

    .price-amount {
        font-size: 20px;
    }

    .price-amount.total {
        font-size: 24px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .portal-header,
    .portal-nav,
    .portal-footer,
    .btn-request,
    .btn-add,
    .carousel-control {
        display: none;
    }

    body {
        background: white;
    }

    .room-card,
    .addon-card {
        box-shadow: none;
        border: 1px solid var(--medium-gray);
        page-break-inside: avoid;
    }
}
