/* ===== GLOBAL COMPONENT STYLES (Clean & Compact) ===== */

/* Base component style for boxes/buttons (Calendar Days, Time Slots, Purpose Buttons) */
.date-box,
.calendar-box,
.tarikh-box,
.day,
.masa-btn,
.tujuan-btn {
    height: 30px;
    padding: 6px 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    background: #f3f4f6;
    color: #111827;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

/* Hover effect – clean, not childish */
.day.available:hover,
.masa-btn:not(:disabled):hover,
.tujuan-btn:hover,
.date-box:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
    border-color: #d1d5db;
}

/* Available / Selected states */
.day.available {
    background: #eff6ff;
    /* Light blue to match "Blue" legend */
    color: #1e40af;
}

.day.selected,
.masa-btn.selected,
.tujuan-btn.selected {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #2563eb;
}

/* Available state specifically for indicators or other uses */
.date-box.available {
    background: #eff6ff;
    color: #1e40af;
}

/* Booked / blocked / disabled */
.day.blocked,
.masa-btn.blocked-slot,
.masa-btn.booked,
.masa-btn:disabled,
.date-box.booked {
    background: #fee2e2 !important;
    color: #991b1b !important;
    cursor: not-allowed !important;
    border-color: #fecaca;
    opacity: 1 !important;
}

/* Calendar Specific Overrides */
.day-names div {
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
    padding-bottom: 8px;
}

.calendar-header span {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

/* Submit Button polish */
.btn-submit {
    height: 46px;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    border: none;
    width: 100%;
    cursor: pointer;
}

.btn-submit:hover {
    background: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* =========================================================
   GLOBAL MOBILE FIT (NO HORIZONTAL SCROLL) - EZBOOKING
   Put this at the VERY BOTTOM of pengguna-ui.css (loaded last)
========================================================= */

/* 1) Hard reset to prevent overflow */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    /* kill sideways scroll */
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

/* Common wrappers */
.desktop-wrapper {
    width: 100%;
    max-width: 100%;
}

/* If your layout uses flex desktop sidebar */
.desktop-wrapper {
    display: flex !important;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    /* IMPORTANT: allows flex children to shrink */
    width: 100%;
    max-width: 100%;
}

/* Containers/cards should never exceed viewport */
.card,
.calendar,
.table-wrap,
.statsbar,
.page-head,
.container,
.content,
.panel,
.box {
    max-width: 100%;
}

/* Tables: scroll inside, not break page */
table {
    max-width: 100%;
}

.table-wrap,
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Calendar: keep inside viewport */
.calendar {
    width: 100%;
    max-width: 100%;
}

.day-names,
.days {
    width: 100%;
    max-width: 100%;
}

/* 2) MOBILE MODE */
@media (max-width: 820px) {

    /* Switch desktop flex layout to mobile stack */
    .desktop-wrapper {
        display: block !important;
    }

    /* Hide desktop sidebar (bottom nav will replace it) */
    .sidebar {
        display: none !important;
    }

    /* Ensure main content is full width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;

        /* add safe padding & bottom space for bottom-nav */
        padding: 14px !important;
        padding-bottom: 96px !important;
    }

    /* Prevent any old desktop offsets from forcing width */
    .main,
    .content,
    .container {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Tighten headers / stats so they don’t overflow */
    .page-head {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .statsbar {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Buttons inputs: full width so no weird squeeze */
    button,
    .btn,
    .btn-submit,
    .btn-save,
    input,
    select,
    textarea {
        max-width: 100%;
    }

    /* Calendar grid spacing (prevents squeeze + overflow) */
    .day-names,
    .days {
        gap: 6px !important;
    }

    /* If any calendar day has fixed width/padding, normalize */
    .day {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Any wide cards that were using fixed px widths */
    .card,
    .calendar,
    .panel,
    .box {
        width: 100% !important;
    }
}

/* =========================
   TUJUAN BUTTON SPACING FIX
========================= */

.tujuan-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    /* 2 columns */
    gap: 14px !important;
    /* 👈 THIS is the key spacing */
    margin-top: 10px !important;
}

.tujuan-btn {
    height: auto !important;
    /* Allow padding to define height */
    padding: 12px 14px !important;
    /* taller, easier tap */
    border-radius: 14px !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
}

.tujuan-btn:active {
    transform: scale(0.98) !important;
}

/* Mobile: more breathing space */
@media (max-width: 820px) {
    .tujuan-buttons {
        gap: 16px !important;
    }

    .tujuan-btn {
        padding: 14px 16px !important;
        font-size: 16px !important;
    }
}

/* =========================
   SPACING BEFORE SUBMIT BUTTON
========================= */

/* Add space AFTER tujuan section */
.tujuan-section {
    margin-bottom: 28px !important;
    /* 👈 main fix */
}

/* Extra safety if structure changes */
.btn-submit,
.btn-save {
    margin-top: 20px !important;
}

/* Mobile: more breathing space */
@media (max-width: 820px) {
    .tujuan-section {
        margin-bottom: 36px !important;
    }

    .btn-submit,
    .btn-save {
        margin-top: 24px !important;
    }
}