/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --bg-input: #16161f;
    --border: #2a2a3a;
    --text: #e8e8f0;
    --text-muted: #8888a0;
    --primary: #6c5ce7;
    --primary-hover: #7d6ff0;
    --primary-glow: rgba(108, 92, 231, 0.3);
    --success: #00b894;
    --success-glow: rgba(0, 184, 148, 0.3);
    --danger: #e74c3c;
    --danger-glow: rgba(231, 76, 60, 0.3);
    --warning: #fdcb6e;
    --accent: #0984e3;
    --accent-glow: rgba(9, 132, 227, 0.3);
    --orange: #e17055;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 0 20px var(--primary-glow); }
.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { box-shadow: 0 0 24px var(--success-glow); transform: translateY(-1px); }
.btn-stop { background: var(--danger); color: white; }
.btn-stop:hover { box-shadow: 0 0 24px var(--danger-glow); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(231, 76, 60, 0.1); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-large { padding: 14px 24px; font-size: 15px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }

/* ===== INPUTS ===== */
.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], select {
    width: 100%; padding: 11px 14px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-family: inherit; font-size: 14px; transition: all 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
input[type="file"] { font-family: inherit; font-size: 13px; color: var(--text-muted); }

/* ===== LOGIN ===== */
.login-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-logo { text-align: center; margin-bottom: 40px; }
.logo-icon {
    width: 72px; height: 72px; background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 18px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; box-shadow: 0 8px 32px var(--primary-glow);
}
.login-logo h1 { font-size: 28px; font-weight: 700; }
.login-logo p { color: var(--text-muted); margin-top: 8px; }
.login-form { width: 100%; max-width: 360px; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; }

/* ===== NAVBAR ===== */
.navbar {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 24px;
    background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 12px; }
.logo-small {
    width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.nav-title { font-weight: 600; font-size: 16px; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.client-view-name { color: var(--primary); font-weight: 600; }

/* ===== ADMIN LAYOUT ===== */
.admin-content { display: flex; flex: 1; min-height: calc(100vh - 61px); }
.sidebar {
    width: 260px; min-width: 260px; background: var(--bg-card); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 15px; font-weight: 600; }
.client-list { flex: 1; overflow-y: auto; padding: 8px; }
.client-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
}
.client-item:hover { background: var(--bg-hover); }
.client-item.active { background: rgba(108, 92, 231, 0.1); border: 1px solid rgba(108, 92, 231, 0.3); }
.client-avatar {
    width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: white; flex-shrink: 0;
}
.client-item-info { flex: 1; min-width: 0; }
.client-item-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-item-hours { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.client-item-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.client-item-status.active-work { background: var(--success); box-shadow: 0 0 8px var(--success-glow); animation: pulse 2s infinite; }

/* ===== MAIN AREA ===== */
.main-area { flex: 1; padding: 24px; overflow-y: auto; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh; text-align: center; }
.empty-icon { margin-bottom: 20px; }
.empty-state h2 { font-size: 22px; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); max-width: 400px; }

/* ===== WORKSPACE HEADER ===== */
.workspace-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 16px; }
.client-info-top { display: flex; align-items: center; gap: 16px; }
.ws-avatar { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: white; }
.client-info h2 { font-size: 22px; font-weight: 700; }
.client-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.meta-tag { padding: 3px 10px; background: var(--bg-hover); border-radius: 6px; font-size: 11px; color: var(--text-muted); }
.meta-tag-accent { background: rgba(108, 92, 231, 0.15); color: var(--primary); }
.workspace-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== QUICK STATS ===== */
.quick-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.quick-stat {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; display: flex; align-items: center; gap: 12px;
}
.quick-stat-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-stat-info { display: flex; flex-direction: column; }
.quick-stat-value { font-size: 18px; font-weight: 700; line-height: 1.2; }
.quick-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== TIMER ===== */
.timer-section {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 32px;
}
.timer-left { flex: 1; }
.timer-right { width: 280px; flex-shrink: 0; }
.timer-status {
    display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 600; margin-bottom: 8px;
}
.timer-status.idle { background: var(--bg-hover); color: var(--text-muted); }
.timer-status.running { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.timer-status.running .status-dot { animation: pulse 1.5s infinite; }
.timer-time { font-size: 52px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 2px; line-height: 1; }
.timer-task { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.timer-buttons { display: flex; gap: 8px; }
.timer-right input { margin-bottom: 10px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
    padding: 10px 18px; background: transparent; border: none; border-bottom: 2px solid transparent;
    color: var(--text-muted); font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== CALENDAR ===== */
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-header h3 { font-size: 18px; font-weight: 600; }
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
}
.cal-header { padding: 10px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-card); text-transform: uppercase; letter-spacing: 0.5px; }
.cal-days { display: contents; }
.cal-day { padding: 8px; min-height: 72px; background: var(--bg); cursor: pointer; transition: all 0.15s; position: relative; }
.cal-day:hover { background: var(--bg-hover); }
.cal-day.other-month { opacity: 0.25; }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day.selected { background: var(--bg-hover); border: 2px solid var(--primary); }
.cal-day-num { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.cal-day-hours { font-size: 11px; color: var(--success); font-weight: 700; }
.cal-day-bar { position: absolute; bottom: 4px; left: 8px; right: 8px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.day-detail { margin-top: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.day-detail h4 { font-size: 15px; margin-bottom: 12px; }
.day-session { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.day-session:last-child { border-bottom: none; }
.day-session-time { color: var(--text-muted); font-size: 13px; }
.day-session-desc { flex: 1; margin: 0 12px; }
.day-session-dur { font-weight: 600; color: var(--primary); white-space: nowrap; }
.day-detail-total-row { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--border); display: flex; justify-content: space-between; font-weight: 600; }

/* ===== SESSIONS LIST ===== */
.sessions-filter { margin-bottom: 16px; }
.sessions-filter select { max-width: 250px; }
.sessions-list { display: flex; flex-direction: column; gap: 4px; }
.session-row {
    display: flex; align-items: center; padding: 12px 16px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-sm); gap: 16px; font-size: 14px;
    transition: border-color 0.15s;
}
.session-row:hover { border-color: var(--primary); }
.session-date { color: var(--text-muted); min-width: 90px; font-size: 13px; }
.session-times { color: var(--text-muted); min-width: 120px; font-size: 13px; }
.session-desc { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-duration { font-weight: 700; color: var(--primary); white-space: nowrap; }
.session-actions { display: flex; gap: 4px; }
.session-actions button { padding: 4px 8px; font-size: 12px; }
.session-type { font-size: 10px; padding: 2px 8px; border-radius: 4px; background: var(--bg-hover); color: var(--text-muted); font-weight: 600; }
.session-type.manual { background: rgba(253, 203, 110, 0.15); color: var(--warning); }
.sessions-summary {
    margin-top: 16px; padding: 16px; background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(9, 132, 227, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.2); border-radius: var(--radius-sm); display: flex; justify-content: space-between; font-weight: 600;
}

/* ===== MANUAL FORM ===== */
.manual-form {
    max-width: 500px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
}
.manual-form-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.manual-form h3 { margin-bottom: 2px; font-size: 16px; }
.form-hint { color: var(--text-muted); font-size: 13px; }
.form-row { display: flex; gap: 16px; }
.form-row .input-group { flex: 1; }

/* ===============================
   CLIENT VIEW - REDESIGNED
   =============================== */
.client-view-content { max-width: 900px; margin: 0 auto; padding: 24px; }

/* Hero */
.cv-hero {
    position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 24px;
    padding: 40px 32px; text-align: center;
}
.cv-hero-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #6c5ce7 0%, #0984e3 50%, #00b894 100%);
    opacity: 0.15;
}
.cv-hero::before {
    content: ''; position: absolute; inset: 0;
    border: 1px solid rgba(108, 92, 231, 0.3); border-radius: var(--radius); pointer-events: none;
}
.cv-hero-content { position: relative; z-index: 1; }
.cv-status { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.cv-status.idle { color: var(--text-muted); }
.cv-status.active { color: var(--success); }
.cv-pulse-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.cv-status.active .cv-pulse-dot { box-shadow: 0 0 16px var(--success-glow); animation: pulse 1.5s infinite; }
.cv-live-timer { margin-top: 16px; }
.cv-time {
    font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 3px;
    background: linear-gradient(135deg, #6c5ce7, #0984e3, #00b894);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    line-height: 1;
}
.cv-task { color: var(--text-muted); font-size: 15px; margin-top: 8px; }

/* Stats */
.cv-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.cv-stat-card {
    border-radius: var(--radius); padding: 20px; text-align: center; position: relative; overflow: hidden;
    border: 1px solid var(--border); background: var(--bg-card);
}
.cv-stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.cv-stat-purple::before { background: linear-gradient(90deg, #6c5ce7, #a29bfe); }
.cv-stat-green::before { background: linear-gradient(90deg, #00b894, #55efc4); }
.cv-stat-blue::before { background: linear-gradient(90deg, #0984e3, #74b9ff); }
.cv-stat-orange::before { background: linear-gradient(90deg, #e17055, #fab1a0); }
.cv-stat-icon { margin-bottom: 8px; opacity: 0.6; }
.cv-stat-purple .cv-stat-icon { color: #a29bfe; }
.cv-stat-green .cv-stat-icon { color: #55efc4; }
.cv-stat-blue .cv-stat-icon { color: #74b9ff; }
.cv-stat-orange .cv-stat-icon { color: #fab1a0; }
.cv-stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.cv-stat-purple .cv-stat-value { color: #a29bfe; }
.cv-stat-green .cv-stat-value { color: #55efc4; }
.cv-stat-blue .cv-stat-value { color: #74b9ff; }
.cv-stat-orange .cv-stat-value { color: #fab1a0; }
.cv-stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

/* Calendar section */
.cv-calendar-section {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; margin-bottom: 24px;
}
.cv-section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.cv-section-title h3 { font-size: 16px; font-weight: 600; }

.cv-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }
.cv-footer strong { color: var(--primary); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px);
}
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 90%; max-width: 440px; box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px;
    z-index: 2000; animation: slideIn 0.3s ease; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 8px;
}
.toast.success { border-color: var(--success); }
.toast.success::before { content: ''; display: block; width: 4px; height: 100%; position: absolute; left: 0; top: 0; bottom: 0; background: var(--success); border-radius: 4px 0 0 4px; }
.toast.error { border-color: var(--danger); }
.toast.error::before { content: ''; display: block; width: 4px; height: 100%; position: absolute; left: 0; top: 0; bottom: 0; background: var(--danger); border-radius: 4px 0 0 4px; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .quick-stats { grid-template-columns: repeat(2, 1fr); }
    .timer-section { flex-direction: column; text-align: center; }
    .timer-right { width: 100%; }
}
@media (max-width: 768px) {
    .admin-content { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; max-height: 180px; border-right: none; border-bottom: 1px solid var(--border); }
    .client-list { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
    .client-item { min-width: 150px; }
    .workspace-header { flex-direction: column; }
    .timer-time { font-size: 36px; }
    .quick-stats { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 0; }
    .cv-stats { grid-template-columns: repeat(2, 1fr); }
    .cv-time { font-size: 42px; }
    .cal-day { min-height: 52px; padding: 4px; }
    .cal-day-num { font-size: 11px; }
    .session-row { flex-wrap: wrap; }
}
