/* ===== CSS Variables ===== */
:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --accent-color: #9b59b6;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --dark-lighter: #34495e;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.2s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
}

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

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

.btn-white:hover {
    background: var(--gray-100);
}

.btn-outline-white {
    background: transparent;
    border: 2px solid var(--white);
    color: var(--white);
}

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

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

/* ===== Landing Page ===== */
.landing-page {
    background: var(--white);
}

.landing-nav {
    background: var(--primary-color);
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.nav-links-landing {
    display: flex;
    gap: 1rem;
}

.nav-links-landing .btn-outline {
    border-color: var(--white);
    color: var(--white);
}

.nav-links-landing .btn-outline:hover {
    background: var(--white);
    color: var(--primary-color);
}

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

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--dark-color) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 2rem 4rem;
}

.hero-content {
    max-width: 700px;
}

.hero-icon {
    margin-bottom: 2rem;
}

.wallet-icon {
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.hero h1 {
    color: var(--white);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 1rem;
}

.hero-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Section */
.features {
    padding: 5rem 2rem;
    background: var(--gray-100);
}

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

.features-title {
    text-align: center;
    font-size: 1.75rem;
    color: var(--gray-700);
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

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

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.feature-icon svg {
    width: 30px;
    height: 30px;
    color: var(--white);
}

.feature-card h3 {
    font-size: 1.25rem;
    color: var(--dark-color);
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

.landing-footer {
    background: var(--dark-color);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 2rem;
}

/* ===== Auth Pages ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--dark-color) 100%);
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

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

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
}

.auth-brand .brand-icon {
    background: var(--primary-color);
    color: var(--white);
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-600);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-600);
}

/* ===== App Layout ===== */
.app-body {
    background: var(--gray-100);
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--dark-color);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand-icon {
    background: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
}

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

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-email {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
}

.logout-btn {
    padding: 0.5rem;
    color: rgba(255,255,255,0.6);
    border-radius: var(--radius);
    transition: var(--transition);
}

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

.logout-btn svg {
    width: 22px;
    height: 22px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

/* ===== Dashboard ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    color: var(--dark-color);
}

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

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-primary .stat-icon {
    background: rgba(52, 152, 219, 0.15);
    color: var(--primary-color);
}

.stat-secondary .stat-icon {
    background: rgba(46, 204, 113, 0.15);
    color: var(--secondary-color);
}

.stat-accent .stat-icon {
    background: rgba(155, 89, 182, 0.15);
    color: var(--accent-color);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-period {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Recent Section */
.recent-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

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

.section-header h2 {
    font-size: 1.25rem;
    color: var(--dark-color);
}

.link-more {
    color: var(--primary-color);
    font-weight: 500;
}

/* Transactions List */
.transactions-list {
    display: flex;
    flex-direction: column;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.transaction-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.transaction-description {
    font-weight: 500;
    color: var(--dark-color);
}

.transaction-meta {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.transaction-right {
    text-align: right;
}

.transaction-amount {
    font-weight: 600;
    color: var(--danger-color);
    display: block;
}

.transaction-date {
    font-size: 0.8rem;
    color: var(--gray-500);
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.form-checkbox {
    display: flex;
    align-items: center;
}

.form-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

.form-checkbox input[type="checkbox"] {
    width: auto;
}

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

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

/* ===== Page Components ===== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--gray-600);
}

.content-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

/* ===== Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.data-table tfoot td {
    font-weight: 600;
    background: var(--gray-100);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-500);
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
}

/* ===== Flash Messages ===== */
.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.flash-success {
    background: rgba(46, 204, 113, 0.15);
    color: #155724;
    border-left: 4px solid var(--secondary-color);
}

.flash-error {
    background: rgba(231, 76, 60, 0.15);
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.flash-info {
    background: rgba(52, 152, 219, 0.15);
    color: #0c5460;
    border-left: 4px solid var(--primary-color);
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

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

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* ===== Reports ===== */
.filter-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.filter-group select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--white);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.summary-card {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    color: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 1.5rem;
}

.summary-card h2 {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.total-amount {
    font-size: 3rem;
    font-weight: 700;
}

/* ===== Categories Page ===== */
.add-form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.add-form-card h2 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.inline-form {
    display: flex;
    gap: 1rem;
}

.inline-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.inline-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.page-info {
    color: var(--gray-600);
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

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

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

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

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

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