/**
 * Work Command Center (WCC)
 * File: public/css/layout.css
 * Layout Grid, Sidebar, Topbar, and Responsive Breakpoints
 */

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-badge {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    color: #ffffff;
    font-weight: 800;
    font-size: 14px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 600;
}

/* User Profile Badge in Sidebar */
.user-profile-badge {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-indigo);
    color: white;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border-left: 3px solid var(--accent-cyan);
}

.nav-icon {
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: 64px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.page-header-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

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

.time-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 12px;
}

.time-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald-glow);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.limit-badge {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.theme-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
}

/* Content Container */
.content-container {
    padding: 24px 28px 40px;
    flex: 1;
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
}

/* 2-Column Dashboard */
.dashboard-columns {
    display: grid;
    grid-template-columns: 66% 34%;
    gap: 20px;
}

.col-main { min-width: 0; }
.col-side { min-width: 0; }

/* Filter Tab Bar */
.filter-tab-bar {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 5px 14px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.filter-btn.active {
    background: var(--accent-cyan);
    color: #042f2e;
    border-color: var(--accent-cyan);
    font-weight: 700;
}

/* Balai RW Grid */
.rw-indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.rw-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.rw-card.border-danger { border-top: 3px solid var(--accent-rose); }
.rw-card.border-amber { border-top: 3px solid var(--accent-amber); }
.rw-card.border-emerald { border-top: 3px solid var(--accent-emerald); }

.rw-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rw-code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.rw-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.rw-figures-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-top: auto;
}

.figure-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fig-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.fig-val { font-size: 16px; font-weight: 800; font-family: var(--font-mono); }
.figure-arrow { color: var(--text-muted); font-size: 12px; }

.rw-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* RW Summary Widget List */
.rw-summary-list {
    display: flex;
    flex-direction: column;
}

.rw-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.rw-val-box {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.rw-val {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-mono);
}

.rw-unit { font-size: 11px; color: var(--text-muted); }

/* Schedules */
.schedule-mini-list {
    display: flex;
    flex-direction: column;
}

.schedule-item {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.schedule-item.has-conflict-border {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--accent-amber);
}

.schedule-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 700;
    white-space: nowrap;
}

.schedule-title {
    font-weight: 600;
    font-size: 13px;
}

/* Team Profile Cards */
.team-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.team-profile-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
}

.tpc-header {
    display: flex;
    gap: 14px;
    align-items: center;
}

.tpc-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    color: white;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpc-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    background: var(--bg-surface);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.stat-box {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
}

.stat-title {
    font-size: 10px;
    color: var(--text-muted);
}

.tpc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Delegation Rules Grid */
.delegation-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.rule-box {
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
}

.rule-box h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

.rule-box ul {
    list-style: none;
    font-size: 13px;
    line-height: 1.8;
}

.rule-box li::before {
    content: "•";
    color: var(--accent-cyan);
    font-weight: bold;
    display: inline-block;
    width: 1em;
}

/* Report Textarea */
.report-preview-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.report-preview-header {
    padding: 12px 18px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-text-area {
    width: 100%;
    background: transparent;
    border: none;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-primary);
    resize: vertical;
    outline: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none; /* Mobile menu can toggle */
    }
    .topbar {
        padding: 0 16px;
    }
    .content-container {
        padding: 16px;
    }
    .sliders-grid {
        grid-template-columns: 1fr;
    }
}
