/* assets/css/style.css */

/* --- Variables --- */
:root {
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --primary-color: #e5ca10;
    --primary-hover: #fce343;
    --text-main: #333333;
    --text-muted: #777777;
    --danger-color: #e74c3c;
    --border-color: #e0e0e0;

    --border-radius: 14px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);

    --font-family: 'Inter', sans-serif;

    /* Maximum app width for desktop to keep it looking like a mobile app */
    --max-app-width: 480px;
}

/* --- Reset & Global --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Container restricts width on desktop, full width on mobile */
.app-container {
    width: 100%;
    max-width: var(--max-app-width);
    background-color: var(--bg-color);
    min-height: 100vh;
    position: relative;
    padding: 20px;
    /* On larger screens, the container itself can look like a phone bezel or simply a card */
}

@media (min-width: 481px) {
    body {
        background-color: #e0e0e0;
        /* Darker bg outside the app */
        align-items: center;
        padding: 40px 0;
    }

    .app-container {
        border-radius: 20px;
        box-shadow: var(--shadow-lg);
        min-height: 80vh;
        /* Don't stretch fully on large screens if not needed */
        background-color: var(--bg-color);
        overflow: hidden;
    }
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--primary-color);
}

.fw-bold {
    font-weight: 700;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-decoration: none;
    gap: 8px;
    margin-bottom: 12px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: rgba(46, 204, 113, 0.1);
}

.btn-danger {
    background-color: #fceceb;
    color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #fadbd8;
}

.btn-link {
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 5px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
    background-color: var(--card-bg);
}

.form-control:focus {
    border-color: var(--primary-color);
}

/* --- Cards / List Items --- */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* Specific to Friends Grid */
.friends-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.friend-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s;
}

.friend-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.friend-name {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.friend-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* --- Layout Elements --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #cccccc;
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Bottom sheet style on mobile */
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-color);
    width: 100%;
    max-width: var(--max-app-width);
    border-radius: 20px 20px 0 0;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

@media (min-width: 481px) {
    .modal-overlay {
        align-items: center;
    }

    .modal-content {
        border-radius: 20px;
        transform: scale(0.95);
        opacity: 0;
    }

    .modal-overlay.active .modal-content {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Checkboxes for expense sharing */
.checkbox-list {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.checkbox-item:last-child {
    border-bottom: none;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: var(--primary-color);
}

/* Expense List inside Event */
.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.expense-info {
    flex: 1;
}

.expense-name {
    font-weight: 500;
    display: block;
}

.expense-payer {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.expense-amount {
    font-weight: 600;
    color: var(--text-main);
}

/* Settlement List Output */
.settlement-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}

.settlement-item i {
    color: var(--primary-color);
    margin: 0 10px;
}

/* Utilities */
.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mb-4 {
    margin-bottom: 32px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background-color: #fceceb;
    color: var(--danger-color);
    border: 1px solid #fadbd8;
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(46, 204, 113, 0.2);
}