/* =====================================================
   Raccoon Timekeeper - Styles
   ===================================================== */

:root {
    --primary: #4a4a4a;
    --primary-dark: #2d2d2d;
    --primary-light: #6b6b6b;
    --accent: #8b8b8b;
    --success: #5a7a5a;
    --success-bg: #e8f0e8;
    --error: #8b5a5a;
    --error-bg: #f5e8e8;
    --warning: #7a6a4a;
    --warning-bg: #f5f0e8;
    --bg-main: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #262626;
    --text-secondary: #525252;
    --text-muted: #737373;
    --border-color: #e0e0e0;
    --border-radius: 12px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Header */
.header {
    background: linear-gradient(135deg, #3d3d3d 0%, #1a1a1a 100%);
    color: white;
    padding: 0 24px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 28px; }
.logo-icon.large { font-size: 48px; }
.logo-text h1 { font-size: 1.25rem; font-weight: 600; }
.logo-text .tagline { font-size: 0.75rem; opacity: 0.8; }

.nav-links { display: flex; align-items: center; gap: 8px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 0.875rem;
}

.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.15); }

/* User Menu */
.user-menu { position: relative; margin-left: 16px; }

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 0.875rem;
}

.user-menu-btn:hover { background: rgba(255,255,255,0.2); }

.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.dropdown-arrow { font-size: 0.6rem; opacity: 0.7; }

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    display: none;
    z-index: 1000;
}

.user-dropdown.active { display: block; }
.user-dropdown a { display: block; padding: 10px 16px; color: var(--text-primary); text-decoration: none; font-size: 0.875rem; }
.user-dropdown a:hover { background: var(--bg-main); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border-color); margin: 4px 0; }

/* Main Content */
.main-content { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h2 { font-size: 1.125rem; font-weight: 600; }

.card-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 24px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 74, 74, 0.1);
}

.input-hint { font-size: 0.75rem; color: var(--text-muted); }
.select-wrapper { position: relative; }
.select-wrapper select { width: 100%; appearance: none; padding-right: 36px; }
.select-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); font-size: 0.75rem; }
.checkbox-group { flex-direction: row; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: linear-gradient(135deg, #4a4a4a 0%, #2d2d2d 100%); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-main); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }
.btn-danger { background: var(--error); color: white; }
.btn-icon { padding: 8px; background: transparent; color: var(--text-secondary); }
.btn-icon:hover { background: var(--bg-main); }
.btn-full { width: 100%; }

/* Week Selector */
.week-selector { display: flex; align-items: center; gap: 12px; }
.week-label { font-weight: 500; min-width: 180px; text-align: center; }

/* Summary Table */
.summary-table-wrapper { overflow-x: auto; padding: 0 24px; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.summary-table th, .summary-table td { padding: 12px; text-align: center; border-bottom: 1px solid var(--border-color); }
.summary-table th { background: var(--bg-main); font-weight: 600; color: var(--text-secondary); }
.summary-table .task-col, .summary-table .task-name { text-align: left; min-width: 150px; }
.summary-table .time-cell.has-time { background: rgba(74, 74, 74, 0.05); font-weight: 500; }
.summary-table .total-cell, .summary-table .grand-total { font-weight: 600; background: var(--primary); color: white; }
.summary-table .totals-row td { font-weight: 600; border-top: 2px solid var(--primary); }

/* Summary Stats */
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 24px; }
.stat-card { text-align: center; padding: 16px; background: var(--bg-main); border-radius: 8px; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.summary-actions { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; }

/* Entries/Tasks List */
.entries-list, .tasks-list, .users-list { padding: 8px; }

.entry-item, .task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.entry-item:hover, .task-item:hover { background: var(--bg-main); }
.entry-main { display: flex; align-items: center; gap: 16px; }
.entry-task, .task-name { font-weight: 500; }
.entry-time { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--primary); }
.entry-details { display: flex; align-items: center; gap: 12px; font-size: 0.875rem; color: var(--text-muted); }

.entry-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 4px 8px;
    transition: var(--transition);
}

.entry-item:hover .entry-delete { opacity: 1; }
.task-item.inactive { opacity: 0.6; }
.task-info { display: flex; align-items: center; gap: 12px; }

.task-badge, .badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; background: var(--bg-main); color: var(--text-muted); }
.inactive-badge { background: var(--error-bg); color: var(--error); }
.admin-badge { background: var(--primary); color: white; }
.entry-count { font-size: 0.875rem; color: var(--text-muted); }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
.data-table th { background: var(--bg-main); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); }
.data-table tr:hover { background: var(--bg-main); }
.data-table tr.inactive { opacity: 0.6; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.status-active { color: var(--success); }
.status-inactive { color: var(--error); }

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active { opacity: 1; visibility: visible; }

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal.active .modal-content { transform: scale(1); }
.modal-large { max-width: 600px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 1.125rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 24px; }
.modal-body .form-grid { padding: 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border-color); background: var(--bg-main); }

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 24px; }
.auth-card { background: white; border-radius: var(--border-radius); box-shadow: var(--shadow-md); padding: 32px; }
.setup-card { max-width: 480px; }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 1.5rem; margin: 16px 0 8px; }
.auth-header p { color: var(--text-muted); }
.auth-form .form-group { margin-bottom: 16px; }
.auth-messages { margin-bottom: 24px; }
.auth-footer { margin-top: 24px; text-align: center; }
.setup-note { font-size: 0.875rem; color: var(--text-muted); padding: 12px; background: var(--bg-main); border-radius: 8px; }

/* Flash Messages */
.flash-messages { max-width: 1400px; margin: 0 auto; padding: 16px 24px 0; }
.flash-message { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-info { background: #e8f0f5; color: #4a6a8b; }
.flash-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; opacity: 0.7; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; }
.toast { padding: 12px 20px; border-radius: 8px; margin-top: 8px; animation: slideIn 0.3s ease; box-shadow: var(--shadow-md); }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--error); color: white; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Empty State */
.empty-state, .loading { text-align: center; padding: 48px 24px; color: var(--text-muted); }

/* Print */
.print-template { display: none; }

@media print {
    body * { visibility: hidden; }
    .print-template, .print-template * { visibility: visible; }
    .print-template { display: block; position: absolute; left: 0; top: 0; width: 100%; padding: 20px; }
    .print-header { text-align: center; margin-bottom: 24px; border-bottom: 2px solid #333; padding-bottom: 16px; }
    .print-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
    .print-user { font-weight: 600; margin-bottom: 4px; }
    .print-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
    .print-table th, .print-table td { border: 1px solid #333; padding: 8px; text-align: center; }
    .print-table th { background: #eee; }
    .print-table .total-row td { border-top: 2px solid #333; font-weight: bold; }
    .print-summary { margin-top: 24px; text-align: right; }
}

/* Responsive */
@media (max-width: 768px) {
    .header-content { flex-direction: column; height: auto; padding: 12px 0; gap: 12px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .form-grid { grid-template-columns: 1fr; }
    .summary-stats { grid-template-columns: 1fr; }
    .summary-table { font-size: 0.75rem; }
    .user-name { display: none; }
}
