/* ShiftSnap - Design System */
:root {
    /* Colors - Dark theme for late-night shift workers */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-elevated: #222230;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-yellow: #eab308;
    --accent-yellow-dim: rgba(234, 179, 8, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    /* Safe areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* App Container */
.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    padding-top: calc(var(--safe-top) + var(--space-md));
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo {
    font-size: 1.5rem;
}

.app-name {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.icon-btn {
    background: var(--bg-card);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--bg-elevated);
}

/* Main Content */
.main {
    flex: 1;
    padding: var(--space-md);
    padding-bottom: calc(80px + var(--safe-bottom) + var(--space-md));
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Today Card */
.today-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2847 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.today-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.today-amount {
    font-size: var(--text-4xl);
    font-weight: 800;
    color: var(--accent-green);
    letter-spacing: -2px;
    line-height: 1.1;
}

.today-detail {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

/* Clock Section */
.clock-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.clock-btn {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-full);
    border: 4px solid var(--accent-green);
    background: var(--accent-green-dim);
    color: var(--accent-green);
    font-size: var(--text-lg);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    transition: all 0.3s;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.2);
}

.clock-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.3);
}

.clock-btn.active {
    border-color: var(--accent-red);
    background: var(--accent-red-dim);
    color: var(--accent-red);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 0 50px rgba(239, 68, 68, 0.4); }
}

.clock-icon {
    font-size: var(--text-2xl);
}

.clock-text {
    font-size: var(--text-base);
}

.shift-timer {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

/* Week Section */
.week-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.section-header h2 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-secondary);
}

.week-total {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--accent-green);
}

.week-bars {
    display: flex;
    gap: var(--space-sm);
    height: 100px;
    align-items: flex-end;
    margin-bottom: var(--space-lg);
}

.week-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.bar-fill {
    width: 100%;
    background: var(--accent-blue);
    border-radius: var(--radius-sm);
    min-height: 4px;
    transition: height 0.5s ease;
}

.bar-fill.today {
    background: var(--accent-green);
}

.bar-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.week-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--bg-elevated);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Shifts Section */
.shifts-section {
    flex: 1;
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
}

.shifts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.shift-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shift-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shift-date {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.shift-hours {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.shift-earnings {
    text-align: right;
}

.shift-gross {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--accent-green);
}

.shift-tips {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

/* Navigation */
.nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-elevated);
    display: flex;
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-sm) var(--space-xs);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--text-secondary);
}

.nav-item.active {
    color: var(--accent-green);
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-label {
    font-weight: 500;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 430px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--bg-elevated);
}

.modal-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    padding-bottom: calc(var(--safe-bottom) + var(--space-lg));
    border-top: 1px solid var(--bg-elevated);
}

/* Shift Summary in Modal */
.shift-summary {
    text-align: center;
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

.shift-time {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
}

.shift-hours-detail {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* Form Elements */
.tip-entry, .setting-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-elevated);
    overflow: hidden;
}

.input-prefix, .input-suffix {
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

input, select {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--text-base);
    padding: var(--space-md);
    font-family: var(--font-sans);
}

input:focus, select:focus {
    outline: none;
}

input::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Earnings Preview */
.earnings-preview {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.earnings-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.earnings-row.total {
    border-top: 1px solid var(--bg-elevated);
    margin-top: var(--space-sm);
    padding-top: var(--space-md);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.earnings-row.net {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--accent-green);
}

/* Buttons */
.btn {
    width: 100%;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    padding: var(--space-sm) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1001;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    font-size: var(--text-sm);
    font-weight: 500;
}

/* Responsive tweaks */
@media (max-width: 380px) {
    .today-amount {
        font-size: var(--text-3xl);
    }
    
    .clock-btn {
        width: 120px;
        height: 120px;
    }
}
