/**
 * Family Holiday Home Booking - Stylesheet
 * Responsive design for PC and Mobile
 */

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

:root {
    --primary-color: #FF385C;
    --primary-hover: #E31C5F;
    --secondary-color: #222222;
    --text-color: #484848;
    --border-color: #DDDDDD;
    --background: #FFFFFF;
    --gray-light: #F7F7F7;
    --success: #00A699;
    --error: #C13515;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.navbar-brand h2 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 600;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* Mobile bottom tab bar (mobile-only; hidden on desktop) */
.mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    background: var(--background);
    border-top: 1px solid var(--border-color);
    display: none;
    grid-template-columns: repeat(5, 1fr);
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

.mobile-tabbar .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 12px;
    padding: 8px 4px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-tabbar .tab-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.mobile-tabbar .tab-item:active {
    background: var(--gray-light);
}

.mobile-tabbar svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.mobile-more-menu {
    position: fixed;
    right: 12px;
    bottom: 76px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    display: none;
    min-width: 180px;
    z-index: 1001;
    overflow: hidden;
}

.mobile-more-menu a {
    display: block;
    padding: 12px 14px;
    color: var(--secondary-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
}

.mobile-more-menu a:last-child {
    border-bottom: none;
}

.mobile-more-menu.open {
    display: block;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

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

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px 16px;
    font-size: 20px;
    background: var(--gray-light);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.login-card {
    background: var(--background);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--secondary-color);
    font-size: 32px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-color);
    font-size: 16px;
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
    background: var(--background);
    color: var(--secondary-color);
    font-weight: 500;
}

.btn-oauth:hover {
    background: var(--gray-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-oauth .icon {
    flex-shrink: 0;
}

.divider {
    position: relative;
    text-align: center;
    margin: 24px 0;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    position: relative;
    background: var(--background);
    padding: 0 16px;
    color: var(--text-color);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

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

.forgot-password {
    text-align: center;
    margin-top: 16px;
}

.forgot-password a {
    color: var(--text-color);
    font-size: 14px;
    text-decoration: none;
}

.forgot-password a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

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

.login-footer a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #FFE8E8;
    color: var(--error);
    border: 1px solid #FFCCCC;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #A5D6A7;
}

/* Main Content */
.main-content {
    padding: 40px 20px;
}

.booking-layout {
    max-width: 1280px;
    margin: 0 auto;
}

/* Bookings Panel */
.bookings-panel {
    background: var(--background);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.bookings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.bookings-header h3 {
    color: var(--secondary-color);
    font-size: 24px;
    margin: 0;
}

.bookings-panel h3 {
    color: var(--secondary-color);
    font-size: 24px;
    margin-bottom: 20px;
}

#bookings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 700px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
}

.empty-state p {
    margin-bottom: 8px;
}

.text-muted {
    color: #999;
    font-size: 14px;
}

.booking-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

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

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

.booking-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.booking-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.booking-name {
    font-weight: 600;
    color: var(--secondary-color);
}

.booking-dates {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--gray-light);
    border-radius: 8px;
    margin-bottom: 12px;
}

.date-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.date-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
}

.date-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--secondary-color);
}

.date-arrow {
    font-size: 20px;
    color: var(--primary-color);
}

.booking-duration {
    font-size: 14px;
    color: var(--text-color);
}

/* Calendar Panel */
.calendar-panel {
    background: var(--background);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
}

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

.calendar-header h3 {
    color: var(--secondary-color);
    font-size: 20px;
}

#calendar {
    margin-bottom: 20px;
}

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

.calendar-weekday {
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    padding: 8px;
}

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

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--background);
}

.calendar-day:hover:not(.disabled):not(.booked) {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.calendar-day.other-month {
    color: #CCC;
}

.calendar-day.today {
    border-color: var(--primary-color);
    font-weight: 600;
}

.calendar-day.booked {
    background: #FFE8E8;
    color: var(--error);
    cursor: not-allowed;
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.calendar-day.in-range {
    background: #FFE8E8;
    border-color: var(--primary-color);
}

.calendar-day.disabled {
    color: #CCC;
    cursor: not-allowed;
}

.calendar-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.legend-color.available {
    background: var(--background);
}

.legend-color.booked {
    background: #FFE8E8;
}

.legend-color.selected {
    background: var(--primary-color);
}

.selected-dates {
    padding: 20px;
    background: var(--gray-light);
    border-radius: 8px;
}

.selected-dates p {
    font-weight: 600;
    margin-bottom: 12px;
}

.selected-range {
    font-size: 16px;
    color: var(--secondary-color);
    margin-bottom: 16px;
    text-align: center;
}

.selected-dates .btn {
    margin-top: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.calendar-modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--text-color);
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--gray-light);
    color: var(--secondary-color);
}

.modal-content {
    background: var(--background);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: var(--secondary-color);
    font-size: 24px;
    margin-bottom: 16px;
}

.modal-content p {
    color: var(--text-color);
    margin-bottom: 20px;
}

.confirmation-dates {
    padding: 16px;
    background: var(--gray-light);
    border-radius: 8px;
    text-align: center;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

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

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--secondary-color);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1001;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .navbar-menu {
        display: none;
    }

    .mobile-tabbar {
        display: grid;
    }

    .main-content {
        padding-bottom: 100px;
    }
}

@media (max-width: 968px) {
    .bookings-panel, .calendar-panel {
        padding: 20px;
    }

    #bookings-list {
        max-height: 400px;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 10px 0;
    }

    .navbar .container {
        padding: 0 12px;
    }

    .navbar-brand h2 {
        font-size: 20px;
    }

    .navbar-menu {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .navbar-menu .btn {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .user-info {
        order: -1;
        width: 100%;
        justify-content: flex-start;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border-color);
    }

    .user-info span {
        font-size: 13px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .main-content {
        padding: 16px 8px;
    }

    .bookings-panel, .calendar-panel {
        padding: 16px;
        border-radius: 12px;
    }

    .bookings-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .bookings-header h3 {
        font-size: 20px;
    }

    .bookings-panel h3 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .calendar-panel h3 {
        font-size: 18px;
    }

    #bookings-list {
        gap: 12px;
    }

    .booking-card {
        padding: 16px;
    }

    .booking-dates {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

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

    .date-arrow {
        transform: rotate(90deg);
        font-size: 18px;
    }

    .date-value {
        font-size: 14px;
    }

    .calendar-day {
        font-size: 13px;
        min-height: 50px;
        padding: 4px;
    }

    .calendar-weekday {
        font-size: 12px;
        padding: 6px;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 12px;
        font-size: 12px;
    }

    .legend-item {
        font-size: 12px;
    }

    .legend-color {
        width: 24px;
        height: 24px;
    }

    .modal-content {
        padding: 24px;
        width: 95%;
        max-width: none;
    }

    .calendar-modal-content {
        width: 98%;
        max-height: 95vh;
        padding: 20px;
    }

    .close-modal {
        font-size: 28px;
        width: 36px;
        height: 36px;
    }

    .modal-content h3 {
        font-size: 20px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .toast {
        right: 10px;
        left: 10px;
        bottom: 10px;
        font-size: 14px;
        padding: 14px 18px;
    }

    .selected-dates {
        padding: 16px;
    }

    .selected-dates .btn {
        padding: 14px;
        font-size: 15px;
        font-weight: 600;
    }

    .btn-sm {
        min-height: 36px;
        padding: 8px 14px;
    }

    /* Improve touch targets */
    .calendar-days {
        gap: 6px;
    }

    .calendar-weekdays {
        gap: 6px;
        margin-bottom: 6px;
    }
}

/* Dark Mode */
.dark-mode {
    --primary-color: #FF385C;
    --primary-hover: #E31C5F;
    --secondary-color: #FFFFFF;
    --text-color: #d1d5db;
    --border-color: #374151;
    --background: #111827;
    --gray-light: #1f2937;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.dark-mode .login-page {
    background: #111827;
}

.dark-mode .divider span {
    background: var(--background);
}

.dark-mode .btn-secondary {
    color: var(--secondary-color);
    background: #374151;
}

.dark-mode .btn-secondary:hover {
    background: #4b5563;
}

.dark-mode .calendar-day.booked {
    background: #4b5563;
    color: var(--text-color);
}

.dark-mode .calendar-day.in-range {
    background: #374151;
}

.dark-mode .badge-success {
    background: #14532d;
    color: #bbf7d0;
}

.dark-mode .badge-warning {
    background: #7c2d12;
    color: #fdba74;
}

.dark-mode .badge-primary {
    background: #1e3a8a;
    color: #bfdbfe;
}

.dark-mode .badge-secondary {
    background: #374151;
    color: #d1d5db;
}

/* Theme Toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 48px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 16px;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Admin Dashboard */
.admin-dashboard {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-dashboard h1 {
    color: var(--secondary-color);
    font-size: 32px;
    margin-bottom: 8px;
}

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

.stat-card {
    background: var(--background);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.admin-section h2 {
    color: var(--secondary-color);
    font-size: 24px;
    margin-bottom: 20px;
}

.users-table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: var(--gray-light);
}

.users-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
}

.users-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.users-table tbody tr:hover {
    background: var(--gray-light);
}

.users-table td button {
    margin-right: 8px;
    margin-bottom: 4px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-warning {
    background: #FFF3E0;
    color: #F57C00;
}

.badge-primary {
    background: #E3F2FD;
    color: #1976D2;
}

.badge-secondary {
    background: var(--gray-light);
    color: var(--text-color);
}

/* Scrollbar Styling */
#bookings-list::-webkit-scrollbar {
    width: 8px;
}

#bookings-list::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 4px;
}

#bookings-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#bookings-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}
