/*
 * OurLife Family Finance Application
 * Main Stylesheet
 */

/* CSS Variables for Theming */
:root {
    /* Dark theme */
    --bg-color: #212529;
    --surface-color: #343a40;
    --text-color: #f8f9fa;
    --text-muted: #adb5bd;
    --primary-color: #3d8bfd;
    --primary-hover: #5c9eff;
    --secondary-color: #6c757d;
    --secondary-hover: #7d8590;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --border-color: #495057;
    --shadow: 0 0.125rem 0.25rem rgba(255, 255, 255, 0.05);
    --chart-grid: rgba(255, 255, 255, 0.1);
    --income-color: #2ecc71;
    --expense-color: #e74c3c;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
.main-header {
    background-color: var(--surface-color);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    text-decoration: none;
    color: var(--primary-color);
}

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

/* Mobile logo hidden by default */
.logo-mobile {
    display: none;
}

/* Main Nav Improvements */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-nav a i {
    font-size: 1.1rem;
}

.main-nav a:hover {
    color: var(--primary-color);
}

.main-nav li.active a {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 2px;
}

/* Hamburger Menu Button */
.hamburger-btn {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Active Hamburger State */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Footer Styles */
.main-footer {
    background-color: var(--surface-color);
    padding: 1.5rem 0;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Cards */
.card {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.card-body {
    padding: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    transition: border-color 0.2s;
}

/* Password visibility toggle */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.password-toggle:hover {
    color: var(--text-color);
}

.password-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    border-radius: 0.3rem;
}

.btn-primary {
    background-color: #4361ee;
    border-color: #4361ee;
    color: white;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #3a56d4;
    border-color: #3a56d4;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.4);
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #5a6268;
    border-color: #545b62;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.4);
}

.btn-success {
    background-color: #2ecc71;
    border-color: #2ecc71;
    color: #212529;
    font-weight: 600;
}

.btn-success:hover, .btn-success:focus {
    background-color: #27ae60;
    border-color: #27ae60;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(46, 204, 113, 0.4);
}

.btn-danger {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.btn-danger:hover, .btn-danger:focus {
    background-color: #c0392b;
    border-color: #c0392b;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.4);
}

.btn-warning {
    background-color: #f39c12;
    border-color: #f39c12;
    color: #212529;
    font-weight: 600;
}

.btn-warning:hover, .btn-warning:focus {
    background-color: #d35400;
    border-color: #d35400;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(243, 156, 18, 0.4);
}

.btn-info {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-info:hover, .btn-info:focus {
    background-color: #2980b9;
    border-color: #2980b9;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.4);
}

.btn-light {
    background-color: #f8f9fa;
    border-color: #f8f9fa;
    color: #212529;
    font-weight: 600;
}

.btn-light:hover, .btn-light:focus {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: #212529;
    box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.4);
}

.btn-dark {
    background-color: #343a40;
    border-color: #343a40;
    color: white;
}

.btn-dark:hover, .btn-dark:focus {
    background-color: #23272b;
    border-color: #1d2124;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.4);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: #4361ee;
    color: #4361ee;
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: #4361ee;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.4);
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: #6c757d;
    color: #adb5bd;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background-color: #6c757d;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.4);
}

/* Make sure the Add New buttons have white text */
.btn-add-new {
    background-color: #4361ee;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-add-new:hover, .btn-add-new:focus {
    background-color: #3a56d4;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    color: white !important;
}

.btn-add-new i {
    font-size: 1.125rem;
}

/* Icon styles for all buttons */
.btn i {
    margin-right: 0.5rem;
}

/* Small button icons */
.btn-sm i {
    font-size: 0.875rem;
}

/* Standard button with icon styling */
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Flash Messages */
.flash-message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.25rem;
}

.flash-message.success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.flash-message.error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.flash-message.info {
    background-color: rgba(23, 162, 184, 0.1);
    border: 1px solid var(--info-color);
    color: var(--info-color);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] th {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    background-color: var(--surface-color);
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-footer {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Chart Container */
.chart-container {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Budget and Project Items */
.item-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: var(--surface-color);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.item-details {
    flex-grow: 1;
}

.item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.item-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.item-amount {
    font-weight: 600;
}

.income {
    color: var(--income-color);
}

.expense {
    color: var(--expense-color);
}

/* Media Queries */
@media (max-width: 941px) {
    .main-header .container {
        position: relative; /* Needed for absolute positioning of nav */
    }
    
    .logo {
        display: none; /* Hide full logo on mobile */
        margin-bottom: 0; /* Remove margin when horizontal */
    }

    .logo-mobile {
        display: block; /* Show mobile logo */
        margin-right: auto; /* Push hamburger to the right */
    }
    
    .logo-mobile a {
        text-decoration: none;
        color: var(--primary-color);
    }
    
    .logo-mobile h1 {
        font-size: 1.5rem;
        margin: 0;
    }

    .hamburger-btn {
        display: block; /* Show hamburger on mobile */
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        left: 0; /* Base position for transform */
        width: 250px; /* Adjust width as needed */
        height: 100vh; /* Full height */
        background-color: var(--surface-color);
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        transform: translateX(-100%); /* Hide off-screen */
        transition: transform 0.3s ease-in-out; /* Animate the transform property */
        z-index: 100; /* Ensure it's behind hamburger if needed */
        padding-top: 4rem; /* Add padding to clear the header area */
        overflow-y: auto; /* Allow scrolling for long menus */
    }
    
    .main-nav.active {
        transform: translateX(0); /* Slide in */
    }
    
    .main-nav ul {
        flex-direction: column; /* Stack links vertically */
        flex-wrap: nowrap; /* Prevent wrapping inside menu */
        gap: 0; /* Remove gap, use padding instead */
        padding: 1rem 0; /* Add vertical padding */
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a {
        padding: 0.75rem 1.5rem; /* Padding for touch targets */
        width: 100%;
        display: block; /* Make link fill width */
        border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle separator */
    }

    .main-nav li.active a {
        border-bottom: none;
        padding-bottom: 0; /* Reset padding */
    }
    
    .main-nav li:last-child a {
        border-bottom: none;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Add rule for iPad portrait/landscape and similar tablets */
@media (max-width: 1024px) {
    /* Stack cards in dashboard-like layouts */
    .dashboard-container .dashboard-row .card,
    .dashboard-container .dashboard-row .chart-card,
    .dashboard-grid .card {
        min-width: 100%;
        flex-basis: 100%;
    }
    
    /* Stack project cards */
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    /* Stack report charts */
    .report-charts .row {
        flex-direction: column;
    }
    .report-charts .chart-container {
        flex: 1 1 100%;
    }
}

/* Login Modal Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-modal {
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.login-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.login-body {
    padding: 1.5rem;
}

.welcome-text {
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.error-message {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.error-message p {
    margin: 0;
    padding: 0.25rem 0;
}

.btn-login {
    display: block;
    width: 100%;
    background-color: var(--primary-color);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 0.25rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-login:hover {
    background-color: var(--primary-hover);
}

@media (max-width: 480px) {
    .login-container {
        padding: 1rem;
    }
    
    .login-modal {
        max-width: 100%;
    }
}

/* Auth Links */
.auth-links {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Dark theme specific styles */
[data-theme="dark"] .empty-state a {
    color: #00b7ff;
    text-decoration: none;
    font-weight: 500;
}

[data-theme="dark"] .empty-state a:hover {
    color: #3dceff;
    text-decoration: underline;
}

[data-theme="dark"] a {
    color: #00b7ff;
}

[data-theme="dark"] a:hover {
    color: #3dceff;
}

[data-theme="dark"] .card a.btn,
[data-theme="dark"] .actions a.btn {
    /* Ensure buttons don't get overridden with link colors */
    color: inherit;
}

[data-theme="dark"] .card a.btn-primary,
[data-theme="dark"] .actions a.btn-primary {
    color: #fff;
}

/* Ensure all blue buttons have white text (Additional selectors) */
[data-theme="dark"] .card a.btn-primary,
[data-theme="dark"] .actions a.btn-primary,
.card a.btn-primary,
.actions a.btn-primary,
.form-actions .btn-primary,
button.btn-primary,
a.btn-primary {
    color: white !important; /* Using !important to override any potential conflicts */
} 