/* Modern Design System for Tanda Web App */
:root {
    --bg-main: #f3f4f6;
    --bg-primary: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border: rgba(0, 0, 0, 0.1);
    --border-color: rgba(0, 0, 0, 0.1);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body.sidebar-open {
    overflow: hidden !important;
}

/* Modern App Layout with Sidebar & Topbar */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
    background-color: var(--bg-main);
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 150;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.sidebar-logo span:last-child {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: none;
}

.sidebar-menu {
    padding: 18px 14px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-menu-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 12px 4px 12px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.sidebar-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}

.sidebar-item.active {
    background: #eef2ff;
    color: var(--primary);
    font-weight: 600;
}

.sidebar-item-icon {
    font-size: 18px;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Sidebar Promo / Tip Box (Estilo Zenvest) */
.sidebar-promo-card {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    padding: 16px;
    margin: 12px 14px;
    text-align: center;
}

.sidebar-promo-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sidebar-promo-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
}

.sidebar-promo-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

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

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Main Wrapper & Topbar */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
}

.topbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-hamburger {
    display: none;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px 6px;
    border-radius: 6px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-title span {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Topbar Search Bar */
.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

.topbar-search input {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 16px 8px 36px;
    font-size: 13px;
    color: var(--text-primary);
    width: 240px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    width: 280px;
}

.topbar-search-icon {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.topbar-icon-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.2);
}

.notification-badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #ffffff;
}

/* User Profile Badge */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.topbar-user:hover {
    background: rgba(0, 0, 0, 0.04);
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
    border: 2px solid #ffffff;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.topbar-user:active .topbar-avatar {
    transform: scale(0.93);
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.2);
}

.topbar-user-details {
    display: flex;
    flex-direction: column;
    text-align: left;
    max-width: 140px;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Content Area inside Main Wrapper */
.content-area {
    padding: 20px 28px 60px 28px;
    flex: 1;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: 270px;
        max-width: 85vw;
        height: 100% !important;
        max-height: 100vh;
        transform: translateX(-100%);
        z-index: 999;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        will-change: transform;
        transition: transform 0.28s cubic-bezier(0.33, 1, 0.68, 1);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle-btn {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        -webkit-tap-highlight-color: transparent;
    }
    .sidebar-overlay.open {
        display: block;
    }
    .topbar-hamburger {
        display: block;
    }
    .topbar {
        padding: 0 16px;
        height: 62px;
        gap: 8px;
        max-width: 100vw;
    }
    .topbar-left {
        gap: 10px;
        min-width: 0;
        flex: 1;
    }
    .topbar-title {
        font-size: 18px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar-right {
        gap: 10px;
        flex-shrink: 0;
    }
    .topbar-user {
        padding: 0;
    }
    .topbar-user-details {
        display: none;
    }
    .topbar-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 15px;
        flex-shrink: 0;
    }
    .content-area {
        padding: 16px 14px 60px 14px;
        max-width: 100vw;
    }
    .topbar-search input {
        width: 140px;
    }
    .topbar-search input:focus {
        width: 170px;
    }
}
@media (max-width: 640px) {
    .topbar-search {
        display: none;
    }
    .topbar-title {
        font-size: 18px;
    }
    .organizer-actions-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .organizer-actions-bar > div:last-child {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    .organizer-actions-bar button {
        width: 100%;
        justify-content: center;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo span {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Recent Tandas Selector */
.tanda-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    max-width: 400px;
}

.chip {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.chip:hover, .chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

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

.btn-secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* Main Dashboard Cards */
.hero-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 32px;
    margin-top: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.tanda-header-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.tanda-title h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
}

.tanda-code-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px dashed var(--primary);
}

/* Spotlight Turn Box */
.spotlight-box {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.spotlight-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-lg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.spotlight-details h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.spotlight-details p {
    color: var(--text-secondary);
    font-size: 14px;
}

.pot-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--success);
    text-align: right;
}

.pot-amount small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Progress Meter */
.progress-container {
    margin-top: 20px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-bar-bg {
    height: 10px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    width: 0%;
    transition: width 0.5s ease;
}

/* Turn Grid & Schedule */
.section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-turns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.turn-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.turn-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 0, 0, 0.2);
}

.turn-card.active-turn {
    border: 2px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.turn-number-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 12px;
}

.active-turn .turn-number-badge {
    background: var(--success);
    color: white;
}

.turn-card h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.turn-card .date {
    font-size: 13px;
    color: var(--text-muted);
}

/* Payment Status Matrix Table */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow-x: auto;
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.status-paid {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

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

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

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

/* Responsiveness */
@media (max-width: 768px) {
    .hero-card { padding: 20px; }
    .tanda-title h1 { font-size: 24px; }
    .spotlight-box { flex-direction: column; align-items: flex-start; }
    .pot-amount { text-align: left; }
}

@keyframes pulse-exciting {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; text-shadow: 0 0 10px rgba(22, 163, 74, 0.5); }
    100% { transform: scale(1); opacity: 0.9; }
}

.exciting-turn-label {
    display: inline-block;
    font-size: 13px;
    color: #16a34a; /* bright green */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(74, 222, 128, 0.15);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(74, 222, 128, 0.3);
    animation: pulse-exciting 2s infinite ease-in-out;
    margin-bottom: 6px;
}


