/* ============================================================================
   GLOBAL STYLES
   ============================================================================ */

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

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --text: #333;
    --border: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
}

html {
    font-size: 16px;
}

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

/* ============================================================================
   LAYOUT
   ============================================================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    list-style: none;
    padding: 1rem 0;
}

.nav-link {
    display: block;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: white;
    color: white;
}

.sidebar-footer {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    padding: 0 1.5rem;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.main-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: 100vh;
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    z-index: 2000;
    display: none;
}

.notification.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.notification.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================================================
   BUTTONS & FORMS
   ============================================================================ */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-block {
    width: 100%;
    display: block;
}

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

form {
    margin-bottom: 1.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="date"],
input[type="month"] {
    cursor: pointer;
}

small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.875rem;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.card-icon {
    font-size: 2.5rem;
}

.card-content {
    flex: 1;
}

.card-label {
    display: block;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0.5rem 0;
}

.stat-card.income {
    border-left: 4px solid var(--success);
}

.stat-card.expense {
    border-left: 4px solid var(--danger);
}

.stat-card.balance {
    border-left: 4px solid var(--primary);
}

/* ============================================================================
   LANDING PAGE
   ============================================================================ */

.landing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 2rem;
}

.landing-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    align-items: center;
}

.landing-content {
    color: white;
}

.landing-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.85;
    line-height: 1.8;
}

.landing-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 0.75rem;
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.feature h3 {
    color: white;
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.landing-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.landing-buttons .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.landing-image {
    display: flex;
    justify-content: center;
}

.dashboard-preview {
    display: grid;
    gap: 1rem;
}

.dashboard-preview .card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transform: perspective(1000px) rotateY(-10deg);
}

/* ============================================================================
   AUTH PAGES
   ============================================================================ */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 2rem;
}

.auth-box {
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #666;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    display: inline-block;
    margin-top: 0.5rem;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.dashboard {
    animation: fadeIn 0.3s ease;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-charts canvas {
    max-height: 400px;
}

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

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.link:hover {
    text-decoration: underline;
}

/* ============================================================================
   TRANSACTIONS
   ============================================================================ */

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.transaction-item {
    display: grid;
    grid-template-columns: 1fr 150px 150px;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border-left: 4px solid var(--light);
}

.transaction-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.transaction-category {
    font-weight: 600;
    color: var(--dark);
}

.transaction-description {
    font-size: 0.9rem;
    color: #666;
}

.transaction-date {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.transaction-amount {
    text-align: right;
    font-weight: 700;
    font-size: 1.1rem;
}

.transaction-amount.income {
    color: var(--success);
}

.transaction-amount.expense {
    color: var(--danger);
}

.transactions-table {
    overflow-x: auto;
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: 100px 150px 200px 100px 100px 100px;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
}

.table-header {
    background-color: var(--light);
    font-weight: 600;
    border-radius: 0.5rem 0.5rem 0 0;
}

.table-row {
    border-bottom: 1px solid var(--border);
}

.table-row:hover {
    background-color: #f8f9fa;
}

.col {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-date { text-align: center; }
.col-category { }
.col-description { }
.col-type { text-align: center; }
.col-amount { text-align: right; }
.col-actions { text-align: center; }

.action-link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    margin: 0 0.5rem;
}

.action-link.delete {
    color: var(--danger);
}

.action-link:hover {
    text-decoration: underline;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-income {
    background-color: #d4edda;
    color: #155724;
}

.badge-expense {
    background-color: #f8d7da;
    color: #721c24;
}

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

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

/* ============================================================================
   FORMS
   ============================================================================ */

.form-card {
    max-width: 600px;
    margin: 0 auto;
}

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

.filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    margin-bottom: 0.5rem;
}

/* ============================================================================
   REPORTS
   ============================================================================ */

.reports-page {
    animation: fadeIn 0.3s ease;
}

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

.report-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.report-actions input,
.report-actions select {
    width: auto;
    padding: 0.5rem 1rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.charts-grid canvas {
    max-height: 300px;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination .btn {
    padding: 0.5rem 1rem;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1500;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

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

.quick-add {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 500;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #999;
}

.empty-state a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* ============================================================================
   PROFILE PAGE
   ============================================================================ */

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

.profile-card {
    margin-bottom: 2rem;
}

.settings-section {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.settings-section:first-child {
    border-top: none;
    padding-top: 0;
}

/* ============================================================================
   PAGE STRUCTURE
   ============================================================================ */

.page {
    animation: fadeIn 0.3s ease;
}

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

.page-header h1 {
    font-size: 2rem;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .landing-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .landing-image {
        display: none;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .table-header,
    .table-row {
        grid-template-columns: 80px 130px 150px 80px 80px 70px;
    }
}

@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 250px;
        z-index: 999;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }

    .landing-content h1 {
        font-size: 2rem;
    }

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

    .report-actions {
        flex-direction: column;
        width: 100%;
    }

    .report-actions input,
    .report-actions select {
        width: 100%;
    }

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

    .table-header,
    .table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .col {
        display: grid;
        grid-template-columns: 120px 1fr;
    }

    .col::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--dark);
    }

    .transaction-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .transaction-date,
    .transaction-amount {
        text-align: left;
    }

    .landing-buttons {
        flex-direction: column;
    }

    .landing-buttons .btn {
        width: 100%;
    }

    .quick-add {
        bottom: 1rem;
        right: 1rem;
    }

    .modal-content {
        margin: 20% auto;
        width: 95%;
    }

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

    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 13px;
    }

    .landing-content h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .landing-features {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .table-header,
    .table-row {
        grid-template-columns: 1fr;
    }
}
