/* CSS Reset and Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --secondary: #f3f4f6;
    --text: #1f2937;
    --text-light: #6b7280;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--secondary);
    color: var(--text);
    line-height: 1.6;
}

#app { min-height: 100vh; }

.screen { display: none; }
.screen.active { display: block; }

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#login-form {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setup-note {
    margin-top: 1rem;
    text-align: center;
    color: rgba(255,255,255,0.8);
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header h1 {
    color: var(--primary);
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Balance Card */
.balance-card {
    background: white;
    margin: 1rem;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
}

.balance-amount.positive { color: var(--success); }
.balance-amount.negative { color: var(--error); }

/* Navigation */
.nav-tabs {
    display: flex;
    background: white;
    margin: 0 1rem;
    border-radius: var(--radius) var(--radius) 0 0;
}

.nav-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 3px solid transparent;
}

.nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content {
    background: white;
    margin: 0 1rem 1rem;
    border-radius: 0 0 var(--radius) var(--radius);
    min-height: 400px;
}

.tab-pane {
    display: none;
    padding: 1rem;
}

.tab-pane.active { display: block; }

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

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

.full-width { width: 100%; }

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

/* Expense List */
.expense-list {
    max-height: 500px;
    overflow-y: auto;
}

.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.expense-item:hover {
    background: var(--secondary);
}

.expense-info { flex: 1; }

.expense-description {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.expense-details {
    font-size: 0.875rem;
    color: var(--text-light);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.expense-amount {
    font-weight: 600;
    font-size: 1.1rem;
}

.expense-actions {
    display: flex;
    gap: 0.5rem;
}

.expense-actions button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* Split Details */
.split-details {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--secondary);
    border-radius: var(--radius);
}

.split-details.hidden { display: none; }

.split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading.hidden { display: none; }

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 300px;
    z-index: 10000;
}

.notification.hidden { display: none; }

.notification.success { border-left: 4px solid var(--success); }
.notification.error { border-left: 4px solid var(--error); }
.notification.warning { border-left: 4px solid var(--warning); }

#notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 640px) {
    .form-actions { flex-direction: column; }
    .expense-item { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .nav-tab { font-size: 0.875rem; padding: 0.75rem 0.5rem; }
    .user-info { flex-direction: column; gap: 0.5rem; align-items: flex-end; }
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: var(--text);
}
