@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    /* Color Palette - Startup Ready Light */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-dark: #0f172a;

    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;

    --secondary: #7c3aed;
    --secondary-light: #a78bfa;

    --accent-emerald: #10b981;
    --accent-emerald-light: #d1fae5;

    --accent-rose: #f43f5e;
    --accent-rose-light: #ffe4e6;

    --accent-amber: #f59e0b;
    --accent-amber-light: #fef3c7;

    --accent-sky: #0ea5e9;
    --accent-sky-light: #e0f2fe;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;

    --border-light: #e2e8f0;
    --border-base: #cbd5e1;

    /* Elevation & Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-full: 9999px;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    margin-bottom: 80px;
    /* Space for mobile action bar */
}

/* Typography */
h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Base Components */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-base);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--border-base);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

input,
select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: var(--transition-base);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 10vh auto;
    padding: 0 20px;
    text-align: center;
}

.auth-container h1 {
    margin-bottom: 8px;
}

.auth-container p {
    margin-bottom: 32px;
}

/* Dashboard Grid */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0 32px;
}

.stat-card {
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Group & Expense Lists */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
}

.list-item:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
}

.item-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.item-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.item-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.item-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.item-right {
    text-align: right;
}

.item-amount {
    font-weight: 700;
    font-size: 1.0625rem;
}

/* Category Icons */
.bg-food {
    background-color: #fee2e2;
    color: #ef4444;
}

.bg-travel {
    background-color: #e0f2fe;
    color: #0ea5e9;
}

.bg-rent {
    background-color: #f3e8ff;
    color: #8b5cf6;
}

.bg-misc {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-pending {
    background: var(--accent-amber-light);
    color: var(--accent-amber);
}

.badge-requested {
    background: var(--accent-sky-light);
    color: var(--accent-sky);
}

.badge-uploaded {
    background: #f3e8ff;
    color: #8b5cf6;
}

.badge-paid {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Action Bar */
.mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-light);
    padding: 12px 16px;
    display: none;
    gap: 12px;
    z-index: 900;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .mobile-action-bar:not(.hidden) {
        display: flex;
    }

    .hide-mobile {
        display: none;
    }
}

/* Layout Utilities */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-8 {
    margin-bottom: 32px;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-surface);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f1f5f9;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Invite Box */
.invite-container {
    background: #f1f5f9;
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--border-base);
    margin-top: 12px;
}

.invite-container:hover {
    background: #e2e8f0;
}

.invite-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.invite-code-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}