/* ==========================================
   1. SYSTEM CONFIG & DESIGN TOKENS
   ========================================== */
:root {
    /* Green Money Palette */
    --clr-bg: #0b1a13;            
    --clr-surface: #12291e;       
    --clr-surface-light: #1b3d2e; 
    --clr-primary: #10b981;       
    --clr-primary-hover: #059669; 
    --clr-danger: #ef4444;       
    --clr-danger-hover: #dc2626;
    --clr-text-main: #f3f4f6;   
    --clr-text-muted: #9ca3af;    
    --clr-neg-text: #ce4646; 
    --clr-border: #234e3b;        
    --clr-neg-border: #641212;    
    
    /* Typography & Structure */
    --font-heading: 'Oswald', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);
    --shadow-dngr: 0 0 20px rgba(185, 16, 53, 0.15);

    /* "YOUR TOTAL" offset */
    --right-offset: 12px;
}

/* ==========================================
   2. BASE RESETS & LAYOUT
   ========================================== */
body {
    font-family: var(--font-body);
    font-size: 16px;
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
    min-height: 100vh;
    margin: 0;
    line-height: 1.5;
}

/* Outer layout wrapper */
.wrapper {
    margin: 0 auto;
    max-width: 800px;
    padding: 2rem 1rem 4rem 1rem;
}

/* Glassmorphic main app container card */
.insideWrapper {
    background-color: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   3. NAVIGATION BAR
   ========================================== */
nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem 1rem 0 1rem;
}

.navlink {
    color: var(--clr-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.navlink:hover {
    background-color: var(--clr-surface-light);
    border-color: var(--clr-border);
    color: #fff;
}

/* Dropdown styling updates to override standard Bootstrap colors */
#logoutNav .btn-secondary {
    background-color: var(--clr-surface);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
}

#logoutNav .btn-secondary:hover, 
#logoutNav .btn-secondary:focus {
    background-color: var(--clr-surface-light);
    border-color: var(--clr-primary);
}

.dropdown-menu {
    background-color: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.dropdown-item {
    color: var(--clr-text-main);
    transition: var(--transition-smooth);
}

.dropdown-item:hover {
    background-color: var(--clr-surface-light);
    color: var(--clr-primary);
}

/* ==========================================
   4. BUDGET HERO CARD (TOTAL CONTAINER)
   ========================================== */
.total-container {
    background: linear-gradient(315deg, #132f22 0%, #0d2118 100%);
    text-align: right;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-glow);

    font-family: var(--font-heading);
    text-transform: uppercase;

    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Natively aligns right edge of text and dollar sign */
    text-align: right;
}

/* Decorative subtle glow element inside balance display */
.total-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 60%);
    pointer-events: none;
}


/* Container wrapper to stack label over value while keeping edges aligned */
.total-txt-wrapper {
    text-align: left;
    
}

.total-label {
    letter-spacing: 1px;
    color: var(--clr-text-muted);
    font-size: 1.1rem;
    line-height: 1.2;
    position: relative;
    right: var(--right-offset); /* Controls precise left offset away from border */
}

#total {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--clr-primary);
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    margin-top: 0.25rem;
    line-height: 1.1;
}

.total-container.neg {
    background: linear-gradient(315deg, #2f1319 0%, #0d2118 100%);
    border: 1px solid var(--clr-neg-border);
    box-shadow: var(--shadow-dngr);
}
.total-container.neg::before {
    background: radial-gradient(circle, rgba(185,16,86,0.08) 0%, transparent 60%);
}
#total.neg {
    color: var(--clr-danger);
    text-shadow: 0 0 15px rgba(185, 16, 86, 0.6);
}

/* ==========================================
   5. TRANSACTION FORMS & INTERACTION
   ========================================== */
.form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* Custom Styled Input Controls */
.form input {
    background-color: var(--clr-bg);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    color: var(--clr-text-main);
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.form input:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form input::placeholder {
    color: var(--clr-text-muted);
}

/* Transaction Action Buttons */
button, .form button {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
}

button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.4;
}

#add-btn {
    /* background-color: var(--clr-primary); */
    background-color: rgba(68, 239, 68, 0.15);
    border: 1px solid var(--clr-primary);
    color: var(--clr-primary);
}

#add-btn:hover {
    background-color: var(--clr-primary-hover);
    transform: translateY(-1px);
    color: #ccc;
}

#sub-btn {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--clr-danger);
    color: var(--clr-danger);
}

#sub-btn:hover {
    background-color: var(--clr-danger);
    color: #ccc;
    transform: translateY(-1px);
}

.error {
    grid-column: span 2;
    color: var(--clr-danger);
    font-weight: 500;
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

/* ==========================================
   6. LEDGER TABLE (TRANSACTIONS)
   ========================================== */
.transactions {
    background-color: var(--clr-bg);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem 1.2rem;
    text-align: left;
}

th {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--clr-surface-light);
    color: var(--clr-text-muted);
    font-size: 0.95rem;
    border-bottom: 2px solid var(--clr-border);
}

tr {
    border-bottom: 1px solid var(--clr-border);
    transition: var(--transition-smooth);
}

tr:last-child {
    border-bottom: none;
}

tr:nth-child(even) {
    background-color: rgba(27, 61, 46, 0.2);
}

tr:hover {
    background-color: rgba(16, 185, 129, 0.05);
}

.table-amount{
    text-align: right;
    padding-right: 16%;
}
.table-amount.neg{
    color: var(--clr-neg-text);
}

.deletable {
    background-color: #e76262 !important;
}

.del-icon {
    content: url(/icons/trash-svgrepo-com.svg);
    width: 1.3rem;
    height: 1.3rem;
    margin-top: .15rem;
    float: right;
    opacity: 0;
}

.deletable .del-icon {
    opacity: 1;
    cursor: pointer;
}

/* ==========================================
   7. VISUAL ANALYTICS CHART
   ========================================== */
#myChart {
    background-color: var(--clr-bg);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1rem;
}

/* ==========================================
   8. BOOTSTRAP OVERRIDES FOR SYSTEM MODALS
   ========================================== */
.modal-content {
    background-color: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    color: var(--clr-text-main);
}

.modal-header {
    border-bottom: 1px solid var(--clr-border);
}

.modal-title {
    font-family: var(--font-heading);
    color: var(--clr-primary);
}

.modal-header .close {
    color: var(--clr-text-muted);
    opacity: 1;
    text-shadow: none;
}

.modal-header .close:hover {
    color: var(--clr-danger);
}

.modalError {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--clr-danger);
    color: var(--clr-danger);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: none; /* Control display gracefully via JS setup */
}

/* Modal Form Specifics */
.modal-body label {
    color: var(--clr-text-muted);
    font-weight: 500;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.modal-body .form-control {
    background-color: var(--clr-bg);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
    border-radius: var(--radius-sm);
}

.modal-body .form-control:focus {
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Standardizing the generic input submit types inside Bootstrap structural forms */
.modal-body input[type="submit"] {
    background-color: var(--clr-primary) !important;
    color: var(--clr-bg) !important;
    border: none !important;
    padding: 0.6rem 2rem !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
    margin: 1.5rem 1rem 0 0 !important; /* Fix inline placement */
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-body input[type="submit"]:hover {
    background-color: var(--clr-primary-hover) !important;
}

.form-btn {
    color: var(--clr-primary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    display: inline-block;
    margin-top: 1.5rem;
}

.form-btn:hover {
    color: var(--clr-primary-hover);
}
