/* assets/css/style.css - Light Mode & Orangish Theme */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #fff7ed;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-orange: #f97316;
    --accent-orange-dark: #ea580c;
    --accent-orange-light: rgba(249, 115, 22, 0.12);
    --accent-amber: #d97706;
    --accent-emerald: #10b981;
    --accent-rose: #e11d48;
    
    --partner-a-color: #f97316;
    --partner-b-color: #0284c7;

    --border-color: #e2e8f0;
    --border-highlight: #fdba74;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 12px 36px rgba(15, 23, 42, 0.12);

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 90px; /* space for sticky button */
}

/* App Container */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* Header Navbar */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 1.6rem;
    background: var(--accent-orange-light);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-logout {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--accent-rose);
    color: #fff;
}

/* Time Filter Navigation */
.filter-section {
    margin-bottom: 20px;
}

.filter-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
    display: none;
}

.pill-btn {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-btn:hover, .pill-btn.active {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    color: #ffffff;
    border-color: var(--accent-orange-dark);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

/* Custom Date Box */
.custom-date-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.custom-date-box input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    width: 100%;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

@media (min-width: 480px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .summary-card.total-card {
        grid-column: span 2;
    }
}

.summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.summary-card.total-card {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    border-color: #ea580c;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.25);
}

.summary-card.total-card .card-label {
    color: rgba(255, 255, 255, 0.9);
}

.summary-card.total-card .card-amount {
    color: #ffffff;
}

.summary-card.total-card .card-subtext {
    color: rgba(255, 255, 255, 0.8);
}

.card-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.card-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Partner Badge Dot */
.partner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Settlement Card */
.settlement-card {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.settlement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.settlement-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #9a3412;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spending Ratio Visual Bar */
.ratio-bar-container {
    height: 10px;
    width: 100%;
    background: #ffedd5;
    border-radius: var(--radius-full);
    overflow: hidden;
    display: flex;
    margin: 12px 0;
}

.ratio-fill {
    height: 100%;
    transition: width 0.4s ease;
}

.settlement-result {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settlement-result.owed {
    background: #ffedd5;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.settlement-result.settled {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.settlement-amount {
    font-weight: 700;
    font-size: 1.05rem;
    color: #c2410c;
    text-decoration: underline;
}

/* Section Header */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Expense List */
.expense-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.expense-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.expense-item:hover {
    border-color: #fdba74;
    box-shadow: var(--shadow-md);
}

.expense-item:active {
    transform: scale(0.99);
}

.expense-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.user-avatar-mini {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.expense-info {
    min-width: 0;
}

.expense-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expense-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.category-tag {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 500;
}

.expense-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.expense-amount {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.expense-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s, background 0.2s;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.btn-icon.delete:hover {
    color: var(--accent-rose);
    background: #ffe4e6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

/* Floating Action Button (Add Expense) */
.fab-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 560px;
    z-index: 90;
}

.btn-fab {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(234, 88, 12, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-fab:active {
    transform: scale(0.98);
}

/* Modal / Bottom Sheet */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

@media (min-width: 540px) {
    .modal-overlay {
        align-items: center;
    }
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 540px) {
    .modal-card {
        border-radius: var(--radius-lg);
        transform: translateY(20px);
    }
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.btn-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-orange);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-submit {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.25);
}

.btn-submit:hover {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
}

/* Login Page Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background-color: #fff7ed;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid #fed7aa;
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-icon {
    font-size: 2.8rem;
    margin-bottom: 10px;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.alert-box {
    background: #ffe4e6;
    border: 1px solid #fecdd3;
    color: var(--accent-rose);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.setup-box {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 20px;
}
