* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #ea580c;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 10px;
    color: var(--text-primary);
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
}

/* Card */
.card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Forms */
.form-inline {
    display: flex;
    gap: 10px;
}

.form-inline input {
    flex: 1;
}

.form-group {
    margin-bottom: 15px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-block {
    width: 100%;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    padding: 5px 10px;
    font-size: 0.875rem;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Accounts List */
.accounts-list {
    display: grid;
    gap: 15px;
}

.account-item {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.account-info {
    flex: 1;
}

.account-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.account-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.account-balance {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: right;
}

.account-balance.positive {
    color: var(--success-color);
}

.account-balance.negative {
    color: var(--danger-color);
}

.account-balance.zero {
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 20px auto;
    border-radius: 12px;
    width: 95%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Balance Summary */
.balance-summary {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.balance-item .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.balance-item .amount {
    font-weight: 600;
    font-size: 1.125rem;
}

.balance-item.balance-total {
    border-top: 2px solid var(--border-color);
    margin-top: 8px;
    padding-top: 12px;
}

.balance-item.balance-total .amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.amount.debit {
    color: var(--warning-color);
}

.amount.credit {
    color: var(--success-color);
}

/* Transactions */
.transactions-header {
    margin: 30px 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.transactions-header h3 {
    font-size: 1.125rem;
}

.transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.transaction-item.debit {
    border-left: 4px solid var(--warning-color);
}

.transaction-item.credit {
    border-left: 4px solid var(--success-color);
}

.transaction-info {
    flex: 1;
}

.transaction-amount {
    font-size: 1.25rem;
    font-weight: 700;
}

.transaction-amount.debit {
    color: var(--warning-color);
}

.transaction-amount.credit {
    color: var(--success-color);
}

.transaction-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.transaction-note {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-top: 5px;
}

.transaction-actions {
    display: flex;
    gap: 5px;
}

/* Loading & Empty States */
.loading,
.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.empty-state {
    font-style: italic;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 10px 5px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .form-inline {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .account-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .account-balance {
        text-align: left;
        width: 100%;
    }
    
    .modal-content {
        margin: 10px;
        width: calc(100% - 20px);
    }
}

/* ============================================
   Authentication Page Styles (login.html)
   ============================================ */

.auth-container {
    max-width: 500px;
    margin: 40px auto;
    padding: 0 20px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    background: white;
    color: var(--text-primary);
    border: none;
    transition: all 0.3s;
}

.auth-tab.active {
    background: var(--primary-color);
    color: white;
}

.auth-tab:hover:not(.active) {
    background: var(--bg-secondary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* Better form styling for login/register page */
.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Alert boxes */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

/* Form hints */
.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Better button styling for auth forms */
.auth-form .btn-block {
    margin-top: 25px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
}

