/* styles.css */
/* Premium design system for Consulting Time Tracker & Invoices */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Dark Theme Variables (Default) */
    --bg-app: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: #3b82f6;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --transition-speed: 0.25s;
    --sidebar-width: 260px;
}

/* Light Theme overrides */
body.light-theme {
    --bg-app: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #cbd5e1;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.1);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 10;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
}

.brand-accent {
    color: var(--accent);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed);
    cursor: pointer;
}

.nav-links li a:hover,
.nav-links li.active a {
    color: var(--text-primary);
    background-color: var(--bg-app);
}

.nav-links li.active a {
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2.5rem 3rem;
    max-width: 1200px;
    width: calc(100% - var(--sidebar-width));
}

/* Section Views */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view-section.active {
    display: block;
}

/* Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Cards & Layout Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-github {
    background-color: #24292e;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-github:hover {
    background-color: #2f363d;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.github-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    margin: 1.5rem 0;
    font-size: 0.85rem;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider:not(:empty)::before {
    margin-right: .75em;
}

.auth-divider:not(:empty)::after {
    margin-left: .75em;
}


/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    outline: none;
    transition: all var(--transition-speed);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Setup Card (Credentials Lock) */
.setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease-out;
}

.setup-card {
    max-width: 500px;
    width: 90%;
}

.setup-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Auth Cards */
.auth-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-app);
}

.auth-card {
    max-width: 400px;
    width: 90%;
}

/* Live Timer Dashboard Component */
.timer-container {
    text-align: center;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-display {
    font-size: 3.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 1rem 0 1.5rem 0;
    letter-spacing: -0.05em;
    font-family: monospace;
}

.timer-active {
    color: var(--accent);
    animation: pulse 2s infinite;
}

/* Lists and Tables */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

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

th {
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
}

.badge-draft { background-color: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }
.badge-sent { background-color: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-paid { background-color: rgba(16, 185, 129, 0.15); color: var(--accent); }
.badge-voided { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Invoice Builder Modal & Step Guides */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Time entries checklist inside builder */
.time-list-selector {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    margin-bottom: 1.25rem;
}

.time-item-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.time-item-checkbox:last-child {
    border-bottom: none;
}

/* Printable Sheet styling in app preview */
.printable-invoice-sheet {
    background-color: #ffffff;
    color: #0f172a;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-color);
}

.printable-invoice-sheet h1,
.printable-invoice-sheet h2,
.printable-invoice-sheet h3,
.printable-invoice-sheet p,
.printable-invoice-sheet td,
.printable-invoice-sheet th {
    color: #0f172a !important;
}

.printable-invoice-sheet hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

/* Print UI action tools */
.invoice-tools {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive adjust */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 2rem 0.5rem;
    }
    
    .sidebar .brand span,
    .sidebar .nav-links span,
    .sidebar .user-info,
    .sidebar .sidebar-footer button span {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
        width: calc(100% - 60px);
        padding: 1.5rem;
    }
}

/* @media print: Pixel Perfect Print Template overrides */
@media print {
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        min-height: auto;
    }
    
    /* Hide all application chrome, navigation, buttons, sidebars */
    .sidebar,
    .section-header,
    .invoice-tools,
    .app-container > *:not(.main-content),
    .main-content > *:not(#invoice-view-section),
    #invoice-view-section > *:not(.printable-invoice-sheet) {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .printable-invoice-sheet {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        background-color: #ffffff !important;
    }
    
    /* Ensure perfect table borders and readable spacing on print */
    table {
        page-break-inside: auto;
    }
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    thead {
        display: table-header-group;
    }
    tfoot {
        display: table-footer-group;
    }
}
