/* Responsive table wrapper for mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 800px) {
    table {
        min-width: 600px;
    }
}

/* Mobile card layout for expense tables */
@media (max-width: 768px) {
    .expense-table-desktop {
        display: none;
    }
    .expense-card-mobile {
        display: block;
    }
    .expense-item-card {
        background: #f9f9f9;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    .expense-item-card .expense-row {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #eee;
    }
    .expense-item-card .expense-row:last-child {
        border-bottom: none;
    }
    .expense-item-card .expense-label {
        font-weight: 600;
        color: #555;
    }
    .expense-item-card .expense-value {
        text-align: right;
        color: #333;
    }
    .expense-item-card .expense-actions {
        margin-top: 0.5rem;
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
    }
}
@media (min-width: 769px) {
    .expense-card-mobile {
        display: none;
    }
    .expense-table-desktop {
        display: block;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

form {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: #fff;
    padding: 2rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(44, 62, 80, 0.08);
}

/* Override form styling for inline forms (e.g., Mark Paid buttons) */
form[style*="display: inline"] {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

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

.form-group label {
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.7rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.94rem;
    background: #f9f9f9;
    transition: border 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #764ba2;
    outline: none;
    box-shadow: 0 0 0 2px #764ba230;
}

.form-group input[type="file"] {
    padding: 0.3rem 0.2rem;
    background: none;
}

.form-group .errorlist,
.form-group span[style*="color: red"] {
    color: #e74c3c;
    font-size: 0.89rem;
    margin-top: 0.2rem;
}

button.btn, .btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    font-size: 0.94rem;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    text-decoration: none !important;
}

/* Default button color (for buttons without a specific variant) */
button.btn:not([class*="btn-"]), .btn:not([class*="btn-"]) {
    background: #0b84ff;
}
button.btn:not([class*="btn-"]):hover, .btn:not([class*="btn-"]):hover {
    background: #5c87bf;
}

@media (max-width: 600px) {
    form {
        padding: 1rem 0.5rem;
        max-width: 98vw;
    }
    .card {
        padding: 1rem 0.5rem;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 0.92rem;
        padding: 0.6rem 0.7rem;
    }
    button.btn, .btn {
        width: 100%;
        font-size: 0.99rem;
        padding: 0.8rem 0;
    }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.94em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.14em;
    opacity: 0.9;
}

.summary-section,
.add-expense-section,
.expenses-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
}

/* ============================================================================
   BUTTON COLOR VARIANTS
   ============================================================================
   
   IMPORTANT: These styles must work for BOTH <button> and <a> elements.
   
   For anchor tags (<a>), we need explicit selectors for ALL link states to
   override browser default link styling (color, underline, visited state).
   
   CSS Specificity Requirements:
   - Use explicit selectors: button.btn-*, a.btn-*, .btn.btn-*
   - Include all pseudo-classes: :link, :visited, :hover, :active, :focus
   - Use !important to ensure these styles take precedence
   - Set both background AND color explicitly
   - Disable text-decoration for link buttons
   
   This comprehensive approach prevents issues where:
   - Links display with default blue/purple colors
   - Links show underlines
   - Visited links change color
   - Button colors don't apply to <a> tags
   ============================================================================ */

/* Edit button (new) - for Edit/Modify actions */
button.btn-edit,
a.btn-edit,
.btn.btn-edit {
    background: #0b84ff !important;
    background-color: #0b84ff !important;
    color: #fff !important;
    text-decoration: none !important;
}
button.btn-edit:hover,
button.btn-edit:focus,
button.btn-edit:active,
a.btn-edit:link,
a.btn-edit:visited,
a.btn-edit:hover,
a.btn-edit:focus,
a.btn-edit:active,
.btn.btn-edit:hover,
.btn.btn-edit:focus,
.btn.btn-edit:active {
    background: #69a3e0 !important;
    background-color: #69a3e0 !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Primary button - purple gradient theme */
button.btn-primary,
a.btn-primary,
.btn.btn-primary {
    background: #764ba2 !important;
    background-color: #764ba2 !important;
    color: #fff !important;
    text-decoration: none !important;
}
button.btn-primary:hover,
button.btn-primary:focus,
button.btn-primary:active,
a.btn-primary:link,
a.btn-primary:visited,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:active,
.btn.btn-primary:hover,
.btn.btn-primary:focus,
.btn.btn-primary:active {
    background: #667eea !important;
    background-color: #667eea !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Success button - green for positive actions */
button.btn-success,
a.btn-success,
.btn.btn-success {
    background: #28a745 !important;
    background-color: #28a745 !important;
    color: #fff !important;
    text-decoration: none !important;
}
button.btn-success:hover,
button.btn-success:focus,
button.btn-success:active,
a.btn-success:link,
a.btn-success:visited,
a.btn-success:hover,
a.btn-success:focus,
a.btn-success:active,
.btn.btn-success:hover,
.btn.btn-success:focus,
.btn.btn-success:active {
    background: #218838 !important;
    background-color: #218838 !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Danger button - red for destructive actions */
button.btn-danger,
a.btn-danger,
.btn.btn-danger {
    background: #dc3545 !important;
    background-color: #dc3545 !important;
    color: #fff !important;
    text-decoration: none !important;
    border: none;
}
button.btn-danger:hover,
button.btn-danger:focus,
button.btn-danger:active,
a.btn-danger:link,
a.btn-danger:visited,
a.btn-danger:hover,
a.btn-danger:focus,
a.btn-danger:active,
.btn.btn-danger:hover,
.btn.btn-danger:focus,
.btn.btn-danger:active {
    background: #c82333 !important;
    background-color: #c82333 !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Secondary button - gray for secondary actions */
button.btn-secondary,
a.btn-secondary,
.btn.btn-secondary {
    background: #6c757d !important;
    background-color: #6c757d !important;
    color: #fff !important;
    text-decoration: none !important;
}
button.btn-secondary:hover,
button.btn-secondary:focus,
button.btn-secondary:active,
a.btn-secondary:link,
a.btn-secondary:visited,
a.btn-secondary:hover,
a.btn-secondary:focus,
a.btn-secondary:active,
.btn.btn-secondary:hover,
.btn.btn-secondary:focus,
.btn.btn-secondary:active {
    background: #5a6268 !important;
    background-color: #5a6268 !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Info button - cyan for informational actions */
button.btn-info,
a.btn-info,
.btn.btn-info {
    background: #17a2b8 !important;
    background-color: #17a2b8 !important;
    color: #fff !important;
    text-decoration: none !important;
}
button.btn-info:hover,
button.btn-info:focus,
button.btn-info:active,
a.btn-info:link,
a.btn-info:visited,
a.btn-info:hover,
a.btn-info:focus,
a.btn-info:active,
.btn.btn-info:hover,
.btn.btn-info:focus,
.btn.btn-info:active {
    background: #138496 !important;
    background-color: #138496 !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Warning button - yellow/orange for warning actions */
button.btn-warning,
a.btn-warning,
.btn.btn-warning {
    background: #ffc107 !important;
    background-color: #ffc107 !important;
    color: #212529 !important;
    text-decoration: none !important;
}
button.btn-warning:hover,
button.btn-warning:focus,
button.btn-warning:active,
a.btn-warning:link,
a.btn-warning:visited,
a.btn-warning:hover,
a.btn-warning:focus,
a.btn-warning:active,
.btn.btn-warning:hover,
.btn.btn-warning:focus,
.btn.btn-warning:active {
    background: #e0a800 !important;
    background-color: #e0a800 !important;
    color: #212529 !important;
    text-decoration: none !important;
}

/* Purple button - additional brand color variant */
button.btn-purple,
a.btn-purple,
.btn.btn-purple {
    background: #9b59b6 !important;
    background-color: #9b59b6 !important;
    color: #fff !important;
    text-decoration: none !important;
}
button.btn-purple:hover,
button.btn-purple:focus,
button.btn-purple:active,
a.btn-purple:link,
a.btn-purple:visited,
a.btn-purple:hover,
a.btn-purple:focus,
a.btn-purple:active,
.btn.btn-purple:hover,
.btn.btn-purple:focus,
.btn.btn-purple:active {
    background: #8e44ad !important;
    background-color: #8e44ad !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Button size variants */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.04rem;
}

/* White button - for landing page CTAs with purple text */
button.btn-white,
a.btn-white,
.btn.btn-white {
    background: white !important;
    background-color: white !important;
    color: #667eea !important;
    text-decoration: none !important;
}
button.btn-white:hover,
button.btn-white:focus,
button.btn-white:active,
a.btn-white:link,
a.btn-white:visited,
a.btn-white:hover,
a.btn-white:focus,
a.btn-white:active,
.btn.btn-white:hover,
.btn.btn-white:focus,
.btn.btn-white:active {
    background: #f0f0f0 !important;
    background-color: #f0f0f0 !important;
    color: #667eea !important;
    text-decoration: none !important;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

/* Utility class for hiding elements */
.d-none {
    display: none !important;
}
