/* /home/dh_sgu9vu/stackdatcash.com/assets/style.css */

:root {
    /* Softer Light Mode Theme - Reduced Contrast */
    --bg-color: #f0f2f5;
    --card-bg: #fafafa;
    --text-main: #4a5568;
    --text-muted: #718096;
    --primary-color: #4a90e2; 
    --border-radius: 12px;
    --input-border: #d1d5db;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Theme */
        --bg-color: #121212;
        --card-bg: #1e1e1e;
        --text-main: #e0e0e0;
        --text-muted: #a0a0a0;
        --primary-color: #64b5f6;
        --input-border: #444444;
    }
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 1rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

/* --- 44px Minimum Touch Targets Constraint --- */
input, select, button, textarea {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-main);
    box-sizing: border-box;
}

button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.btn-primary {
    width: 100%;
    margin-top: 1rem;
}

/* --- Buttons --- */
.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: #aaa;
}

.btn-remove {
    background-color: #e53935;
    color: white;
    flex: 0 0 44px;
    padding: 0;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.btn-remove:hover {
    background-color: #c62828;
}

.btn-sm {
    min-height: 44px;
    min-width: 44px;
    flex: initial;
    padding: 0 0.75rem !important;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- Login & Forms --- */
.login-card {
    max-width: 400px;
    margin: 2rem auto;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.alert.error {
    background-color: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 44px;
}

.alert.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 44px;
}

@media (prefers-color-scheme: dark) {
    .alert.error {
        background-color: #3b1a1a;
        color: #ff8a80;
    }

    .alert.success {
        background-color: #1b3a1e;
        color: #a5d6a7;
        border-color: #2e7d32;
    }
}

.header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-card h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* --- Table Layout --- */
.table-responsive {
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem 0.5rem; 
    text-align: left;
    border-bottom: 1px solid var(--input-border);
    white-space: nowrap;
}

th {
    font-weight: 600;
    color: var(--text-muted);
}

.action-cell {
    display: flex;
    gap: 0.5rem;
}

.text-danger {
    color: #d32f2f;
    font-weight: 600;
}

.text-success {
    color: #388e3c;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .text-danger { color: #ef5350; }
    .text-success { color: #66bb6a; }
    
    .btn-secondary:hover {
        background-color: rgba(255, 255, 255, 0.1);
        border-color: #777;
    }
    
    .btn-remove:hover {
        background-color: #b71c1c;
    }
}

/* --- Summary Filter --- */
.summary-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.summary-filter .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 120px;
}

.summary-filter .btn-primary {
    flex: 0 0 auto;
    margin-top: 0;
}

tfoot th {
    border-top: 2px solid var(--input-border);
    padding-top: 1rem;
}

/* --- Navigation Bar Styling --- */
.navbar {
    display: flex;
    align-items: center;
    gap: 1.5rem; 
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1.5rem;
}

.brand-text {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.account-switcher {
    margin: 0;
    display: flex;
    align-items: center;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.nav-link.text-danger:hover {
    background-color: #ffebee;
    color: #d32f2f;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (prefers-color-scheme: dark) {
    .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    .nav-link.text-danger:hover {
        background-color: rgba(239, 83, 80, 0.2);
        color: #ef5350;
    }
}

/* --- Goals & Progress Bars --- */
.progress-wrapper {
    margin: 1rem 0;
}
.progress-container {
    width: 100%;
    background-color: var(--input-border);
    border-radius: 8px;
    overflow: hidden;
    height: 24px;
    margin: 0.5rem 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}
.progress-fill.complete {
    background-color: #66bb6a;
}
.goal-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Modern Transaction Form (EveryDollar Clone) --- */
.type-toggle {
    display: flex;
    background: var(--bg-color);
    padding: 0.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}
.type-toggle label {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}
.type-toggle input[type="radio"] {
    display: none;
}
.type-toggle input[type="radio"]:checked + label {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.large-amount-wrapper {
    position: relative;
    margin-bottom: 1rem;
}
.large-amount-wrapper span {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--text-muted);
}
.large-amount-wrapper input {
    font-size: 1.2rem;
    padding: 1rem 1rem 1rem 2rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 600px) {
    .form-row-2 { grid-template-columns: 1fr; }
}

.budget-items-header {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 1.5rem 0 1rem 0;
    color: var(--text-main);
}

.split-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.split-item select {
    flex: 2;
}
.split-amount-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}
.split-amount-wrapper span {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
}
.split-amount-wrapper input {
    padding-left: 1.5rem;
}
.btn-remove-split {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 0.5rem;
}
.btn-remove-split:hover {
    color: #d32f2f;
}

.split-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--input-border);
}
.btn-add-split {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
}
.remaining-amount {
    font-size: 0.95rem;
    color: var(--text-muted);
}
.remaining-amount strong {
    color: var(--primary-color);
}
.remaining-amount strong.error {
    color: #d32f2f;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}