/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #0F766E;
    --primary-light: #14B8A6;
    --primary-dark: #0D5C56;
    --primary-bg: #F0FDFA;
    --secondary: #F59E0B;
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --info: #3B82F6;
    --dark: #111827;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topbar-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--gray-50);
    color: var(--dark);
    font-size: 14px;
    line-height: 1.6;
}

/* ========= LAYOUT ========= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;        /* prevent layout overflow on smaller screens */
    min-width: 0;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

/* ========= SIDEBAR ========= */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
    min-height: 64px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    transition: var(--transition);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--gray-500);
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--gray-100); }

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    margin-bottom: 2px;
}

.nav-item i {
    font-size: 18px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.nav-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

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

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-100);
    font-size: 11px;
    line-height: 1.4;
    transition: var(--transition);
}

/* ========= TOPBAR ========= */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 200;
    overflow: hidden;          /* prevent topbar from expanding horizontally */
    min-width: 0;
}

.topbar-left {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.topbar-left h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-left p {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 0;
}

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

.notification-btn {
    position: relative;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
}
.notification-btn:hover { background: var(--gray-50); }

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.page-content {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;        /* prevent page-level horizontal scroll */
    min-width: 0;              /* flex child can shrink below content size */
    max-width: 100%;
}

/* ========= STAT CARDS ========= */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-card .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

.stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* ========= CARDS ========= */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.card-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin: 0;
}

.card-body { padding: 20px; }

/* ========= BADGES ========= */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-confirmed { background: #DCFCE7; color: #16A34A; }
.badge-waiting { background: #FEF9C3; color: #CA8A04; }
.badge-completed { background: #DBEAFE; color: #2563EB; }
.badge-cancelled { background: #FEE2E2; color: #DC2626; }
.badge-rejected { background: #FEE2E2; color: #DC2626; }
.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-paid { background: #DCFCE7; color: #16A34A; }
.badge-pending { background: #FEF9C3; color: #CA8A04; }
.badge-partial { background: #FEF3C7; color: #D97706; }
.badge-failed { background: #FEE2E2; color: #DC2626; }
.badge-unpaid { background: var(--gray-100); color: var(--gray-600); }
.badge-active { background: #DCFCE7; color: #16A34A; }
.badge-inactive { background: var(--gray-100); color: var(--gray-600); }

.membership-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    display: inline-block;
}

/* ========= BUTTONS ========= */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); color: white; }

.btn-teal { background: #0F766E; color: white; }
.btn-teal:hover { background: #0D5C56; color: white; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; color: white; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

.btn-secondary-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}
.btn-secondary-outline:hover { background: var(--gray-100); }

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

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ========= FORMS ========= */
.form-group { margin-bottom: 16px; }

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--dark);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.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 12px center;
    padding-right: 36px;
}
.form-select:focus { border-color: var(--primary); outline: none; }

.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .form-control { border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm); }
.input-group .btn { border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0; }
.input-group .input-group-text {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    padding: 0 12px;
    font-size: 13px;
    color: var(--gray-500);
    border-right: none;
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

/* ========= TABLE ========= */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 100%;
}

/* Any card that directly contains a table gets scroll too */
.card-body > .table-wrapper,
.card-body > table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child { border-bottom: none; }

.table td {
    padding: 14px 16px;
    vertical-align: middle;
}

.table td .customer-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.table td .customer-email {
    font-size: 12px;
    color: var(--gray-500);
}

/* ========= QUICK ACTIONS ========= */
.quick-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    color: white;
    transition: var(--transition);
}
.quick-action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: white; }

.quick-action-card .qa-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.quick-action-card .qa-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
}

.quick-action-card .qa-text span {
    font-size: 12px;
    opacity: 0.85;
}

/* ========= CALENDAR ========= */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.cal-header {
    background: var(--gray-50);
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
}

.cal-day {
    background: #fff;
    min-height: 80px;
    padding: 6px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}
.cal-day:hover { background: var(--gray-50); }
.cal-day.today { background: var(--primary-bg); }
.cal-day.today .day-number { 
    background: var(--primary); 
    color: white; 
    border-radius: 50%; 
    width: 26px; 
    height: 26px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.cal-day.other-month .day-number { color: var(--gray-300); }

.day-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-dots {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.cal-dot.confirmed { background: #10B981; }
.cal-dot.waiting { background: #F59E0B; }
.cal-dot.cancelled { background: #EF4444; }
.cal-dot.completed { background: #6B7280; }

/* ========= FORM BUILDER ========= */
.builder-layout {
    display: grid;
    grid-template-columns: 220px 1fr 240px;
    gap: 16px;
    height: calc(100vh - 140px);
}

.builder-panel {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow-y: auto;
}

.builder-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-weight: 700;
    font-size: 13px;
    color: var(--gray-700);
    background: var(--gray-50);
}

.component-tabs {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid var(--gray-100);
}

.comp-tab {
    flex: 1;
    padding: 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-500);
    border: none;
    background: none;
    transition: var(--transition);
}
.comp-tab.active { background: var(--primary); color: white; }

.component-list { padding: 8px; }

.comp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: grab;
    margin-bottom: 4px;
    border: 1px solid var(--gray-200);
    background: #fff;
    transition: var(--transition);
    font-size: 13px;
    color: var(--gray-700);
}
.comp-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.comp-item i { font-size: 16px; color: var(--gray-400); }
.comp-item:hover i { color: var(--primary); }

.form-canvas {
    background: var(--gray-50);
    padding: 16px;
    border: 2px dashed var(--gray-200);
    border-radius: var(--border-radius);
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
    transition: var(--transition);
    position: relative;
}

/* Canvas field cards */
.canvas-field {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    position: relative;
}
.canvas-field:hover  { border-color: var(--primary); }
.canvas-field.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.canvas-field-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.canvas-field-title {
    font-weight: 600;
    font-size: .9rem;
    flex: 1;
}
.canvas-field-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s;
}
.canvas-field:hover .canvas-field-actions,
.canvas-field.selected .canvas-field-actions { opacity: 1; }
.canvas-field-preview { pointer-events: none; }
.drag-handle {
    cursor: grab;
    color: var(--gray-400);
    font-size: 1rem;
    padding: 0 2px;
    flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; }
.canvas-field.dragging-field { opacity: .5; }
.drop-indicator {
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    margin: 4px 0;
    animation: pulse .6s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.form-canvas.drag-over { border-color: var(--primary); background: var(--primary-bg); }

.canvas-field {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}
.canvas-field:hover { border-color: var(--primary); }
.canvas-field.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }

.canvas-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.canvas-field-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
}

.canvas-field-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}
.canvas-field:hover .canvas-field-actions { opacity: 1; }

.drag-handle {
    cursor: grab;
    color: var(--gray-400);
    padding: 2px;
}

.field-action-btn {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--gray-500);
    transition: var(--transition);
}
.field-action-btn:hover { background: var(--gray-100); }
.field-action-btn.delete:hover { background: #FEE2E2; color: var(--danger); border-color: var(--danger); }

.settings-section { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
.settings-section h6 { font-size: 12px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }

.gateway-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1.5px solid var(--gray-200);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    margin: 3px;
    font-weight: 500;
    transition: var(--transition);
}
.gateway-option.selected { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.gateway-option.selected.manual { border-color: var(--primary); background: var(--primary); color: white; }

/* ========= ANALYTICS ========= */
.chart-container {
    position: relative;
    height: 220px;
}

.insight-card {
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.insight-card.success { background: #DCFCE7; border-color: #BBF7D0; }
.insight-card.warning { background: #FEF9C3; border-color: #FDE68A; }
.insight-card.info { background: #DBEAFE; border-color: #BFDBFE; }

/* ========= MEMBERSHIP ========= */
.member-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
}
.member-card:hover { box-shadow: var(--shadow); }

.member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.tier-progress {
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.tier-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ========= BOOKING FORM (PUBLIC) ========= */
.booking-wrapper {
    min-height: 100vh;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.booking-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
}

.booking-header {
    padding: 24px;
    color: white;
    text-align: center;
}

.booking-body { padding: 28px; }

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
}

.step-circle.active { background: var(--primary); color: white; }
.step-circle.done { background: var(--success); color: white; }

.step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
}

.step-divider {
    flex: 1;
    height: 2px;
    background: var(--gray-200);
    max-width: 40px;
    margin: 0 4px;
}
.step-divider.done { background: var(--success); }

/* ========= MODALS ========= */

/* ── Bootstrap 5 modal z-index overrides ──────────────────────────── */
/* Ensures modals always appear above sidebar (z:300) and topbar (z:200) */
.modal-backdrop { z-index: 1040 !important; }
.modal          { z-index: 1050 !important; }

/* Bootstrap modal dialog improvements */
.modal-dialog {
    margin: auto;
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}
.modal-content {
    border: none;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    overflow: hidden;
}
.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-body  { padding: 24px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    gap: 8px;
}

/* Scrollable modal — cap height and scroll body */
.modal-dialog-scrollable {
    max-height: calc(100vh - 3.5rem);
}
.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    flex: 1;
}

/* XL modal max width sensible cap */
.modal-xl { max-width: min(1140px, calc(100vw - 40px)); }



/* ========= ALERT / TOAST ========= */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-msg {
    background: white;
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

.toast-msg.success { border-color: var(--success); }
.toast-msg.success i { color: var(--success); }
.toast-msg.error { border-color: var(--danger); }
.toast-msg.error i { color: var(--danger); }
.toast-msg.info { border-color: var(--info); }
.toast-msg.info i { color: var(--info); }

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

/* ========= LOGIN ========= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    margin: 0 auto 16px;
}

/* ========= UTILITY ========= */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-sm { font-size: 12px; }
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.p-0 { padding: 0; }
.rounded { border-radius: var(--border-radius-sm) !important; }
.w-100 { width: 100%; }
.cursor-pointer { cursor: pointer; }
.flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }

/* Grid */
.row { display: flex; flex-wrap: wrap; margin: -8px; }
.col { flex: 1; padding: 8px; }
.col-2 { flex: 0 0 16.666%; padding: 8px; }
.col-3 { flex: 0 0 25%; padding: 8px; }
.col-4 { flex: 0 0 33.333%; padding: 8px; }
.col-6 { flex: 0 0 50%; padding: 8px; }
.col-8 { flex: 0 0 66.666%; padding: 8px; }
.col-12 { flex: 0 0 100%; padding: 8px; }

/* Responsive */
/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (max 1024px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    /* ── Tablet: sidebar hidden, hamburger seperti mobile ── */
    .sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
    }
    .sidebar.mobile-open .brand-text,
    .sidebar.mobile-open .nav-label,
    .sidebar.mobile-open .sidebar-footer { display: block !important; opacity: 1 !important; }
    .main-content { margin-left: 0 !important; width: 100%; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1049; }
    .sidebar-overlay.active { display: block; }

    /* Hamburger button visible on tablet */
    #mobileMenuBtn { display: inline-flex !important; }

    /* Stat cards 2-column */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .col-md-3 { flex: 0 0 50% !important; max-width: 50% !important; }
    .col-md-4 { flex: 0 0 50% !important; max-width: 50% !important; }

    /* Vertical stack untuk konten 2-kolom */
    .row.row-tablet-stack > [class*="col-"] { flex: 0 0 100% !important; max-width: 100% !important; }

    /* Tables scroll */
    .table-wrapper { overflow-x: auto; }
    .table-wrapper table { min-width: 700px; }

    /* Page content */
    .page-content { padding: 20px; }

    /* Banner responsive */
    #dashBannerWrap { border-radius: 12px !important; }

    /* Calendar grid stack */
    .cal-layout-grid { grid-template-columns: 1fr !important; }

    /* Force vertical: analytics filter + reservations filter */
    .d-flex.gap-2.align-items-center.flex-wrap { flex-direction: column; align-items: stretch !important; }
    .d-flex.gap-2.align-items-center.flex-wrap .form-select { width: 100% !important; }
    #filterForm .row > * { flex: 0 0 100% !important; max-width: 100% !important; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (max 768px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Sidebar: hidden by default, slide in on toggle ── */
    .sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform 0.3s ease;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }

    /* Sidebar overlay when open */
    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1049;
    }
    .sidebar-overlay.active { display: block; }

    /* ── Page header ── */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    .page-header .btn, .page-header button { width: 100%; }

    /* ── Page content padding ── */
    .page-content { padding: 12px; }

    /* ── Cards: full width, reduce padding ── */
    .card { border-radius: 10px; margin-bottom: 12px; }
    .card-body { padding: 12px !important; }
    .card-header { padding: 10px 12px !important; }

    /* ── Stats grid: 2 columns on mobile ── */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.4rem; }

    /* ── Tables: scroll horizontally ── */
    .table-wrapper,
    .table-responsive,
    .table-responsive-wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch; width: 100%; }
    .table-wrapper table,
    .table-responsive table { min-width: 560px; font-size: 12px; }
    .table-wrapper th, .table-wrapper td,
    .table-responsive th, .table-responsive td { padding: 7px 9px; white-space: nowrap; }

    /* ── Bootstrap grid override: semua jadi vertical stack ── */
    .col-md-3, .col-md-4 { flex: 0 0 50% !important; max-width: 50% !important; }
    .col-md-6, .col-md-8 { flex: 0 0 100% !important; max-width: 100% !important; }
    .col-3, .col-4        { flex: 0 0 50% !important; max-width: 50% !important; }
    .col-6                { flex: 0 0 100% !important; max-width: 100% !important; }
    .row.g-4 { --bs-gutter-x: 0.75rem; }
    /* Calendar: stack panels */
    .row.g-3 > .col-md-8, .row.g-3 > .col-md-4 { flex: 0 0 100% !important; max-width: 100% !important; }

    /* ── Modals ── */
    .modal-dialog        { margin: 8px; }
    .modal-xl, .modal-lg { max-width: calc(100vw - 16px) !important; }
    .modal-dialog-scrollable .modal-content { max-height: calc(100dvh - 60px); }
    .modal-body          { padding: 14px; }
    .modal-footer        { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
    .modal-footer .btn   { flex: 1; min-width: 100px; }

    /* ── Navigation topbar ── */
    .topbar { padding: 0 12px; height: auto; min-height: 52px; flex-wrap: nowrap; }
    .topbar .breadcrumb, .topbar .page-subtitle { display: none; }
    .topbar-left h4, .topbar-left h5 { font-size: .88rem !important; }
    .topbar-right { gap: 6px; flex-shrink: 0; }

    /* ── Form builder ── */
    .builder-layout { grid-template-columns: 1fr !important; }

    /* ── Reservations table ── */
    .reservation-table td:nth-child(3),
    .reservation-table td:nth-child(4) { display: none; }

    /* ── Kasir: scan box full width ── */
    .scan-box { max-width: 100% !important; }

    /* ── Filters: stack vertically ── */
    #filterForm .row > [class^="col-"] {
        flex: 0 0 100% !important; max-width: 100% !important;
    }

    /* ── Analytics charts ── */
    .chart-container { height: 220px !important; }

    /* ── Settings sidebar ── */
    .settings-nav { display: flex; overflow-x: auto; flex-direction: row !important;
                    gap: 4px; padding: 8px !important; white-space: nowrap; }
    .settings-nav .nav-link { padding: 6px 12px !important; border-radius: 20px !important;
                               font-size: .78rem; }

    /* ── Tickets layout ── */
    .col-md-3 { flex: 0 0 100% !important; max-width: 100% !important; margin-bottom: 12px; }

    /* ── Action buttons: wrap ── */
    .d-flex.gap-2 { flex-wrap: wrap; }
    .btn-group { width: 100%; }

    /* ── Typography ── */
    h4, h5.fw-bold { font-size: 1rem; }
    .fs-5 { font-size: .95rem !important; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (max 480px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr !important; }
    .stat-value { font-size: 1.2rem; }
    .modal-footer .btn { width: 100%; }

    /* Stack filter buttons */
    #filterForm .d-flex { flex-direction: column; }
    #filterForm .btn { width: 100%; margin-top: 6px; }

    /* Kasir hari ini list */
    .today-res-item { flex-direction: column; gap: 4px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    z-index: 10;
}

/* ── Form Builder – Drop indicator & drag states ── */
.drop-indicator {
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    margin: 4px 0;
    position: relative;
}
.drop-indicator::before {
    content: '';
    position: absolute;
    left: -4px; top: -4px;
    width: 10px; height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.canvas-field.dragging-field {
    opacity: 0.4;
    border-style: dashed;
}

.comp-item.dragging {
    opacity: 0.5;
}

.form-canvas.drag-over {
    border-color: var(--primary) !important;
    background: var(--primary-bg) !important;
    box-shadow: inset 0 0 0 3px rgba(15,118,110,0.15);
}

.canvas-field {
    cursor: default;
}
.canvas-field .drag-handle {
    cursor: grab;
    user-select: none;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--gray-400);
    transition: var(--transition);
}
.canvas-field .drag-handle:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}
.canvas-field .drag-handle:active {
    cursor: grabbing;
}

.comp-item {
    cursor: pointer;
    user-select: none;
}
.comp-item:active {
    transform: scale(0.97);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    pointer-events: none;
}

.field-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state h5 { font-size: 16px; font-weight: 600; color: var(--gray-500); }
