/* ===== CSS Variables ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ===== Navigation ===== */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-900);
}

.nav-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

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

/* ===== Auth Card (Login/Signup) ===== */
.auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-card h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.auth-card .subtitle {
    color: var(--gray-600);
    margin-bottom: 30px;
}

.form-section {
    text-align: left;
}

.form-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.form-section input,
.form-section textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
}

.form-section input:focus,
.form-section textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.toggle-link {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-600);
}

.toggle-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.toggle-link a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

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

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

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

.btn-success:hover {
    background: #15803d;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ===== Messages ===== */
.message {
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    text-align: center;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
}

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

.welcome-section h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.welcome-section p {
    color: var(--gray-600);
}

/* ===== Properties Grid ===== */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.property-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.property-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.property-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.property-card h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.property-card p {
    color: var(--gray-600);
    margin-bottom: 20px;
}

/* ===== Property Header ===== */
.property-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.property-icon-large {
    font-size: 4rem;
}

.property-header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.property-header .location {
    color: var(--gray-600);
    margin-bottom: 10px;
}

/* ===== Booking Layout ===== */
.booking-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 768px) {
    .booking-layout {
        grid-template-columns: 1fr;
    }
}

.calendar-section,
.booking-form-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.calendar-section h2,
.booking-form-section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
}

/* ===== Calendar Legend ===== */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.dot.available {
    background: var(--gray-200);
}

.dot.my-booking {
    background: var(--success);
}

.dot.my-pending {
    background: var(--warning);
}

.dot.booked {
    background: var(--danger);
}

/* ===== Calendar ===== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header h3 {
    font-size: 1.2rem;
}

/* Selection Indicator */
.selection-indicator {
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.cancel-selection {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cancel-selection:hover {
    background: rgba(255, 255, 255, 0.3);
}

.calendar-nav {
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s;
}

.calendar-nav:hover {
    background: var(--gray-200);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 0;
    color: var(--gray-600);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--gray-100);
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day:hover:not(.past):not(.booked):not(.empty) {
    background: var(--gray-200);
    transform: scale(1.05);
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
}

.calendar-day.past {
    background: var(--gray-50);
    color: var(--gray-400);
    cursor: not-allowed;
}

.calendar-day.my-booking {
    background: var(--success);
    color: white;
}

.calendar-day.my-pending {
    background: var(--warning);
    color: white;
}

.calendar-day.booked {
    background: var(--danger);
    color: white;
    cursor: not-allowed;
}

.calendar-day.selected {
    outline: 3px solid var(--primary);
}

/* ===== Form Groups ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input[readonly] {
    background: var(--gray-50);
    cursor: default;
}

/* ===== Bookings Section ===== */
.bookings-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.bookings-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.bookings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.booking-card {
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.2s;
}

.booking-card.status-approved {
    border-color: var(--success);
    background: #f0fdf4;
}

.booking-card.status-pending {
    border-color: var(--warning);
    background: #fffbeb;
}

.booking-card.status-cancelled {
    border-color: var(--gray-300);
    background: var(--gray-50);
    opacity: 0.7;
}

.booking-card.status-rejected {
    border-color: var(--danger);
    background: #fee2e2;
}

.booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.booking-header h3 {
    font-size: 1.2rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.pending {
    background: var(--warning);
    color: white;
}

.status-badge.approved {
    background: var(--success);
    color: white;
}

.status-badge.rejected {
    background: var(--danger);
    color: white;
}

.status-badge.cancelled {
    background: var(--warning);
    color: white;
}

.booking-dates {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--gray-700);
}

.nights {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.booking-notes {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--gray-600);
}

/* ===== Admin Panel ===== */
.admin-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.admin-header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.admin-bookings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-booking-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.admin-booking-card.status-approved {
    border-color: var(--success);
}

.admin-booking-card.status-pending {
    border-color: var(--warning);
}

.booking-info {
    flex: 1;
    min-width: 250px;
}

.user-info {
    color: var(--gray-600);
    margin-bottom: 5px;
}

.booking-meta {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 10px;
}

.booking-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== Utilities ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-600);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray-600);
    font-style: italic;
}

.error {
    color: var(--danger);
    text-align: center;
    padding: 20px;
}

/* ===== Toast Notifications ===== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .navbar {
        padding: 12px 15px;
    }

    .nav-links {
        width: 100%;
        justify-content: space-between;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .auth-card {
        padding: 30px 20px;
        margin: 30px auto;
    }

    .welcome-section {
        padding: 20px;
    }

    .welcome-section h1 {
        font-size: 1.5rem;
    }

    .property-header {
        flex-direction: column;
        text-align: center;
    }

    .property-header h1 {
        font-size: 1.5rem;
    }

    .calendar-section,
    .booking-form-section {
        padding: 20px;
    }

    .admin-booking-card {
        flex-direction: column;
    }

    .booking-actions {
        width: 100%;
    }

    .booking-actions .btn {
        flex: 1;
    }
}

/* ===== Admin Timeline Calendar ===== */
.admin-calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.admin-calendar-controls h2 {
    margin: 0;
    font-size: 1.5rem;
}

.property-calendar-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
}

.property-calendar-section h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--gray-900);
}

.timeline-calendar {
    min-width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.timeline-header {
    display: grid;
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-300);
}

.user-column-header {
    padding: 12px;
    font-weight: 600;
    border-right: 2px solid var(--gray-300);
    position: sticky;
    left: 0;
    background: var(--gray-100);
    z-index: 10;
}

.day-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    border-right: 1px solid var(--gray-200);
    line-height: 1.2;
    white-space: nowrap;
}

.day-header:last-child {
    border-right: none;
}

.timeline-row {
    display: grid;
    border-bottom: 1px solid var(--gray-200);
}

.timeline-row:hover {
    background: var(--gray-50);
}

.user-column {
    padding: 12px;
    border-right: 2px solid var(--gray-300);
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
}

.timeline-row:hover .user-column {
    background: var(--gray-50);
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.user-email {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.day-cell {
    min-height: 50px;
    border-right: 1px solid var(--gray-200);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.day-cell:last-child {
    border-right: none;
}

.date-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-900);
}

.day-cell.booked .date-number {
    color: white;
}

.day-cell.booked {
    background: var(--gray-300);
}

.day-cell.booked.approved {
    background: var(--success);
}

.day-cell.booked.pending {
    background: var(--warning);
}

.day-cell.booked.first-day {
    border-left: 3px solid var(--gray-700);
}

.day-cell.booked.approved.first-day {
    border-left-color: #15803d;
}

.day-cell.booked.pending.first-day {
    border-left-color: #d97706;
}

.day-cell.booked.last-day {
    border-right: 3px solid var(--gray-700);
}

.day-cell.booked.approved.last-day {
    border-right-color: #15803d;
}

.day-cell.booked.pending.last-day {
    border-right-color: #d97706;
}

.nights-badge {
    background: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-900);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Mobile: Make timeline scrollable horizontally */
@media (max-width: 768px) {
    .property-calendar-section {
        padding: 15px;
    }
    
    .timeline-header,
    .timeline-row {
        grid-template-columns: 150px repeat(auto-fit, minmax(30px, 1fr));
    }
    
    .user-column-header,
    .user-column {
        width: 150px;
    }
    
    .day-header {
        font-size: 0.65rem;
        padding: 6px 2px;
    }
    
    .user-name {
        font-size: 0.8rem;
    }
    
    .user-email {
        font-size: 0.7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Gallery Swiper */

.gallery-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.gallery-swiper {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 80vh;
    position: relative;
}

.gallery-swiper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.gallery-thumbs {
    margin-top: 10px;
    height: 80px;
}

.gallery-thumbs .swiper-slide {
    width: 80px;
    opacity: 0.6;
    cursor: pointer;
}

.gallery-thumbs .swiper-slide-thumb-active {
  opacity: 1;
  border: 2px solid black;
  border-radius: 6px;
  overflow: hidden;
}

.gallery-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}
