:root {
    --primary: #FF4D00;
    --primary-hover: #E64500;
    --primary-soft: rgba(255, 77, 0, 0.08);
    --bg-main: #F4F7FA;
    --bg-sidebar: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --white: #FFFFFF;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    
    --blue: #3B82F6;
    --green: #10B981;
    --purple: #8B5CF6;
    --orange: #FF4D00;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    max-width: 100vw;
    overflow-x: hidden;
}
html { max-width: 100vw; overflow-x: hidden; }

/* Utilities */
.show-on-mobile { display: none !important; }

h1, h2, h3, .brand { font-family: 'Outfit', sans-serif; }

.app-container { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
}

.logo { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #FF8C00);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 77, 0, 0.3);
}
.logo-icon i { color: white; width: 24px; height: 24px; }
.brand { font-size: 22px; font-weight: 700; color: var(--text-main); line-height: 1; }
.pro { font-size: 11px; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; }

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}
.nav-item i { width: 20px; height: 20px; }
.nav-item:hover { background: var(--bg-main); color: var(--primary); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar-footer { padding-top: 24px; border-top: 1px solid var(--border-color); }
.user-profile { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--bg-main); }
.user-name { font-size: 14px; font-weight: 600; }
.user-role { font-size: 12px; color: var(--text-muted); }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
.top-bar {
    height: 80px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(12px);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0; z-index: 100;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #F1F5F9;
    padding: 10px 18px;
    border-radius: 14px;
    width: 360px;
    gap: 12px;
    transition: all 0.3s;
}
.search-bar:focus-within { background: white; box-shadow: 0 0 0 2px var(--primary-soft); }
.search-bar input { border: none; background: transparent; outline: none; font-size: 14px; width: 100%; color: var(--text-main); }

.header-actions { display: flex; gap: 12px; }
/* Buttons & UI Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #FF7A00);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 77, 0, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 77, 0, 0.3);
}

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

.btn-secondary:hover {
    background: #E2E8F0;
    transform: translateY(-1px);
}

/* Filters & Shift Selectors */
.filters, .shift-selector {
    display: flex;
    gap: 8px;
    background: #EDF2F7;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
}

.filter-btn, .shift-btn {
    padding: 10px 22px;
    border: none;
    background: transparent;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover, .shift-btn:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
}

.filter-btn.active, .shift-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
}

/* Views Base */
.view-container { padding: 40px; max-width: 1400px; margin: 0 auto; width: 100%; }
.view { display: none; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.view.active { display: block; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard View */
.welcome-banner {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    border-radius: 28px;
    padding: 48px;
    color: white;
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}
.welcome-banner h1 { font-size: 36px; margin-bottom: 12px; }
.welcome-banner p { font-size: 18px; opacity: 0.7; }
.floating-icon { position: absolute; right: -20px; top: -20px; width: 180px; height: 180px; opacity: 0.1; color: var(--primary); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 40px; }
.stat-card {
    background: white;
    padding: 32px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 24px; }

.dashboard-charts { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; }
.section-card { background: white; border-radius: 24px; padding: 32px; box-shadow: var(--shadow-sm); }
.section-card h3 { margin-bottom: 24px; font-size: 18px; font-weight: 700; }

/* Member View Controls */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}
.section-title h2 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.view-controls { display: flex; align-items: center; gap: 24px; }

.view-switcher {
    background: #EDF2F7;
    padding: 6px;
    border-radius: 18px;
    display: flex;
    gap: 6px;
}

.view-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: 14px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover { background: rgba(255, 255, 255, 0.5); color: var(--primary); }
.view-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow-md); }

/* Members Grid Layout */
.members-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.premium-member-card {
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.premium-member-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-soft);
}

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

.card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-soft), #FFF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    border: 1px solid var(--primary-soft);
}

.member-info h4 { font-size: 18px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.member-tag {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body { margin-bottom: 24px; }
.info-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; color: var(--text-muted); }
.info-row i { width: 16px; height: 16px; }

.card-footer {
    padding-top: 20px;
    border-top: 1px solid #F1F5F9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expiration-warning {
    color: #EF4444;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-actions { display: flex; gap: 8px; }
.mini-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #F8FAFC;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mini-btn:hover { background: var(--primary-soft); color: var(--primary); }
.mini-btn.btn-pay { color: var(--green); }
.mini-btn.btn-pay:hover { background: var(--bg-green-soft); }

/* Status Labels */
.tag-morning { background: #E0F2FE; color: #0369A1; }
.tag-evening { background: #FEF3C7; color: #B45309; }
.tag-active { background: #DCFCE7; color: #15803D; }
.tag-inactive { background: #F1F5F9; color: #475569; }
.tag-both { background: #F5F3FF; color: #7C3AED; }

/* Tables */
.table-container { background: white; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #F8FAFC; padding: 18px 24px; text-align: left; font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.data-table td { padding: 18px 24px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.data-table tr:last-child td { border-bottom: none; }

.status-badge { padding: 6px 14px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.status-active { background: #DCFCE7; color: #15803D; }
.status-inactive { background: #F1F5F9; color: #475569; }

.action-btns { display: flex; gap: 8px; }
.action-btn { padding: 8px; border-radius: 8px; border: none; cursor: pointer; transition: 0.2s; background: #F1F5F9; color: var(--text-muted); }
.action-btn:hover { background: var(--primary-soft); color: var(--primary); }

/* Attendance */
.attendance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.member-card {
    background: white;
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}
.member-card:hover { border-color: var(--primary-soft); transform: scale(1.03); }
.member-card.present { border-color: var(--green); background: #F0FDF4; }
.member-card.present .initials { background: var(--green); color: white; }

.initials {
    width: 60px; height: 60px;
    background: #F1F5F9;
    color: var(--text-muted);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px;
    transition: 0.3s;
}

/* Modals */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: none; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal.active { display: flex; }
.modal-content {
    background: white; width: 100%; max-width: 540px;
    border-radius: 32px; padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes zoomIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 10px; color: #334155; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 14px 18px; border: 2px solid #F1F5F9; border-radius: 14px;
    font-size: 15px; outline: none; transition: 0.2s; background: #F8FAFC;
}
.form-group input:focus { border-color: var(--primary); background: white; }

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

.modal-footer { margin-top: 12px; display: flex; justify-content: flex-end; gap: 12px; }

.close-modal {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F1F5F9;
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #FEE2E2;
    color: #EF4444;
    transform: rotate(90deg);
}

.close-modal i {
    width: 18px;
    height: 18px;
}

/* Helpers */
/* New Premium Styles */
.announcement-banner {
    background: linear-gradient(135deg, #FF4D00, #FF8C00);
    color: white;
    padding: 24px;
    border-radius: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 16px rgba(255, 77, 0, 0.2);
}
.ann-icon {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.ann-content h4 { margin-bottom: 4px; }
.ann-content p { font-size: 14px; opacity: 0.9; }

.activity-list { display: flex; flex-direction: column; gap: 16px; }
.activity-item { display: flex; align-items: center; gap: 16px; }
.activity-details p { font-size: 14px; font-weight: 600; }
.activity-details span { font-size: 12px; color: var(--text-muted); }

.expiring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.expiring-item {
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    padding: 16px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.expiring-item .m-info strong { display: block; font-size: 14px; }
.expiring-item .m-info span { font-size: 12px; color: #C53030; }

.badge {
    background: #EF4444;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
}

.btn-sm { padding: 8px 16px; font-size: 12px; border-radius: 12px; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-main); color: var(--primary); }

/* Attendance Redesign */
.attendance-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.att-stat-box { padding: 24px; border-radius: 20px; text-align: center; }
.att-stat-box .label { display: block; font-size: 14px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.att-stat-box .value { font-size: 32px; font-weight: 800; font-family: 'Outfit'; }

.attendance-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; min-height: 500px; }
.att-column { background: white; border-radius: 24px; padding: 24px; box-shadow: var(--shadow-sm); }
.col-header { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid #F1F5F9; }

.attendance-list-container { display: flex; flex-direction: column; gap: 12px; }
.att-item { 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 16px 20px; border-radius: 16px; border: 1px solid var(--border-color);
    transition: 0.2s; cursor: pointer;
}
.att-item:hover { transform: scale(1.02); box-shadow: var(--shadow-md); }
.att-item.present { background: #F0FDF4; border-color: #DCFCE7; }
.att-item.absent { background: #FEF2F2; border-color: #FEE2E2; }

.att-item-info { display: flex; align-items: center; gap: 12px; }
.att-item-info strong { font-size: 15px; }

.date-selector input {
    padding: 10px 16px; border: 2px solid var(--border-color); border-radius: 12px;
    font-family: inherit; font-weight: 600; color: var(--text-main); outline: none;
}
.date-selector input:focus { border-color: var(--primary); }

.bg-red-soft { background: #FEF2F2; }
.text-red { color: #EF4444; }

/* Profile View Styles */
.profile-container { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.profile-header-card {
    background: white; padding: 32px; border-radius: 24px; box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 24px; position: relative;
}
.profile-avatar-big {
    width: 80px; height: 80px; background: var(--primary); color: white;
    border-radius: 20px; display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 800; font-family: 'Outfit';
}
.profile-main-info h3 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.profile-main-info p { color: var(--text-muted); font-weight: 600; }
#btn-open-edit-profile { position: absolute; top: 32px; right: 32px; }

.profile-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-card {
    background: white; padding: 24px; border-radius: 20px; box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 16px; border: 1px solid var(--border-color);
}
.detail-icon {
    width: 48px; height: 48px; background: var(--bg-main); border-radius: 12px;
    display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.detail-content .label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.detail-content .value { font-size: 16px; font-weight: 700; color: var(--text-main); }

/* Bottom Navigation (Hidden on Desktop) */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        display: none; /* Hide sidebar completely on mobile */
    }
    
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-color);
        justify-content: space-around;
        padding: 12px 0 20px 0; /* Extra padding for iOS safe area */
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    }
    
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--text-muted);
        gap: 6px;
        flex: 1;
        transition: 0.2s;
        -webkit-tap-highlight-color: transparent;
    }
    
    .bottom-nav-item i { width: 22px; height: 22px; }
    .bottom-nav-item span { font-size: 11px; font-weight: 600; }
    .bottom-nav-item.active { color: var(--primary); }
    .bottom-nav-item.active i { fill: var(--primary-soft); color: var(--primary); }
    
    .show-on-mobile { display: inline-flex !important; }
    .hide-on-mobile { display: none !important; }
    
    .main-content {
        width: 100%;
        max-width: 100vw;
        padding-bottom: 90px; /* Space for bottom nav */
    }
    
    .top-bar {
        padding: 0 16px;
        height: 60px;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .search-bar { 
        flex: 1; 
        width: auto;
        padding: 8px 14px;
    }
    
    .table-container {
        overflow-x: auto;
        max-width: 100%;
    }
    
    .data-table {
        min-width: 600px; /* Prevent table text from squishing too much */
    }
    
    .header-actions .user-profile { display: none; } /* Hide duplicate profile in header */
    
    .view-container { padding: 16px; }
    
    .dashboard-charts { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; gap: 16px; }
    
    .welcome-banner { padding: 24px; border-radius: 20px; }
    .welcome-banner h1 { font-size: 24px; }
    .welcome-banner p { font-size: 15px; }
    .floating-icon { right: -40px; top: -40px; width: 140px; height: 140px; }
    
    .section-title { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
    .section-title h2 { font-size: 22px; }
    
    .members-grid-container { grid-template-columns: 1fr; }
    
    .form-grid { grid-template-columns: 1fr; }
    .modal-content { padding: 24px; border-radius: 24px; margin: 16px; max-height: 90vh; overflow-y: auto; }
    
    .attendance-columns { grid-template-columns: 1fr; min-height: auto; }
    .attendance-stats-row { grid-template-columns: 1fr; gap: 12px; }
    .att-stat-box { padding: 16px; }
    .att-stat-box .value { font-size: 24px; }
    
    .profile-details-grid { grid-template-columns: 1fr; }
    .profile-header-card { flex-direction: column; text-align: center; padding-top: 48px; }
    #btn-open-edit-profile { position: static; margin-top: 16px; }
}
