/* Budgetary App - Main Stylesheet */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background-color: white;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

.navbar h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.navbar ul {
    display: flex;
    list-style: none;
    gap: 1rem;
}

.navbar a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.navbar a:hover,
.navbar a.active {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header Section */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-section h2 {
    font-size: 2rem;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #0891b2;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

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

.project-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.project-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-right: 1rem;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.project-meta {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.meta-item .label {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Budget Summary */
.budget-summary {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.budget-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.budget-row.expense {
    color: var(--danger-color);
}

.budget-row.income {
    color: var(--success-color);
}

.budget-row.balance {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
}

.budget-row.positive {
    color: var(--success-color);
}

.budget-row.negative {
    color: var(--danger-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0 0.25rem 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.3s ease;
}

.progress-fill.over-budget {
    background-color: var(--danger-color);
}

.budget-percent {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Project Actions */
.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Forms */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Tables */
.data-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background-color: var(--light-bg);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: var(--light-bg);
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

/* Budget Overview */
.budget-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.budget-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.budget-card.expense {
    border-left-color: var(--danger-color);
}

.budget-card.income {
    border-left-color: var(--success-color);
}

.budget-card.positive {
    border-left-color: var(--success-color);
}

.budget-card.negative {
    border-left-color: var(--danger-color);
}

.budget-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.budget-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Sections */
.section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    margin-bottom: 0;
}

/* Project Info */
.project-info {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.project-info p {
    margin-bottom: 0.75rem;
}

/* Empty States */
.empty-state,
.empty-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Budget Overrun Styling */
tr[style*="background-color: #fce7f3"] {
    border-left: 4px solid #be123c !important;
}

tr[style*="background-color: #fce7f3"]:hover {
    background-color: #fbcfe8 !important;
}

/* Profile Dropdown Menu */
.profile-menu {
    position: relative;
}

.profile-menu .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.profile-menu:hover .dropdown-menu {
    display: block;
}

.profile-menu .dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s;
}

.profile-menu .dropdown-item:hover {
    background-color: var(--light-bg);
}

.profile-menu .dropdown-item:first-of-type {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.profile-menu .dropdown-item:last-of-type {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-content h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-content p {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Chart Cards */
.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Success/Error Messages */
.success-message {
    background-color: #dcfce7;
    color: #166534;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #bbf7d0;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .navbar h1 {
        font-size: 1.25rem;
    }

    .navbar ul {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .navbar li a {
        width: 100%;
        text-align: center;
    }

    .header-section {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start !important;
    }

    .header-section > div {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .budget-overview {
        grid-template-columns: 1fr;
    }

    .project-actions {
        flex-direction: column;
    }

    .project-actions .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Tables on mobile */
    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    /* Stack forms vertically on mobile */
    .form-group {
        margin-bottom: 1rem;
    }

    /* Hide less important columns on mobile */
    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        display: none;
    }

    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Stat cards */
    .stat-card {
        min-height: auto;
    }

    .stat-card h3 {
        font-size: 2rem;
    }

    /* Pagination on mobile */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem !important;
    }

    .pagination .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Notification on mobile */
    .notification {
        min-width: 280px;
        max-width: calc(100% - 2rem);
        top: 10px;
        right: 10px;
        font-size: 0.875rem;
    }

    /* Profile dropdown on mobile */
    .profile-menu .dropdown-menu {
        right: 0;
        left: auto;
        min-width: 200px;
    }

    /* Chart containers on mobile */
    .chart-card {
        padding: 1rem;
    }

    /* Filter forms on mobile */
    .section form {
        flex-direction: column !important;
    }

    .section form .form-group {
        width: 100% !important;
        min-width: auto !important;
    }

    /* View toggle buttons */
    .view-toggle {
        width: 100%;
        justify-content: center;
    }

    /* Budget alert box on mobile */
    div[style*="background: #fef2f2"] {
        padding: 0.75rem 1rem !important;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .stat-card h3 {
        font-size: 1.75rem;
    }

    .stat-card p {
        font-size: 0.85rem;
    }

    /* Even smaller table text */
    .data-table {
        font-size: 0.8rem;
    }

    /* Hide pagination page numbers on very small screens */
    .pagination > div {
        display: none !important;
    }

    /* Stack filter inputs */
    .header-section select,
    .header-section input {
        width: 100% !important;
    }
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
    font-size: 0.95rem;
    font-weight: 500;
}

.notification.success {
    background-color: #10b981;
    color: white;
}

.notification.error {
    background-color: #ef4444;
    color: white;
}

.notification.warning {
    background-color: #f59e0b;
    color: white;
}

.notification.info {
    background-color: #3b82f6;
    color: white;
}

.notification .notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification .notification-message {
    flex: 1;
}

.notification .notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.notification .notification-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification.slide-out {
    animation: slideOut 0.3s ease-out forwards;
}
