/* Base theme */
:root {
    --bg-primary: #1F2937;
    --bg-secondary: #111827;
    --bg-card: #1F2937;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --accent-color: #10B981;
    --accent-hover: #059669;
    --danger-color: #EF4444;
    --danger-hover: #DC2626;
    --border-color: #374151;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --input-bg: #374151;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Sidebar */
nav.fixed {
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    z-index: 50;
}

nav a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-radius: 0.5rem;
}

nav a:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

nav a.active {
    background-color: var(--accent-color);
    color: var(--text-primary);
}

/* Cards */
.rounded-xl {
    border-radius: 1rem;
}

.bg-gray-800 {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

/* Card hover effects */
.transform.hover\:scale-105:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Form elements */
input, select, textarea {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    width: 100%;
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Buttons */
button {
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.bg-emerald-500 {
    background-color: var(--accent-color);
}

.bg-emerald-500:hover {
    background-color: var(--accent-hover);
}

.bg-red-600 {
    background-color: var(--danger-color);
}

.bg-red-600:hover {
    background-color: var(--danger-hover);
}

/* Transaction items */
.transaction-item {
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.transaction-item:hover {
    transform: translateX(8px);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.new-transaction {
    animation: slideIn 0.3s ease-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

/* Logo bounce animation */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.animate-bounce-subtle {
    animation: bounce 2s infinite ease-in-out;
}

/* Chart styles */
canvas {
    max-width: 100%;
    margin: 0 auto;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Notifications */
.notification {
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive design */
@media (max-width: 768px) {
    nav.fixed {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

    nav.fixed.show {
        transform: translateX(0);
    }

    .ml-64 {
        margin-left: 0;
        padding: 1rem;
    }

    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .rounded-xl {
        border-radius: 0.75rem;
    }

    /* Improved touch targets for mobile */
    button, 
    select,
    input[type="date"],
    input[type="month"] {
        min-height: 48px;
        padding: 0.75rem 1rem;
    }

    /* Better spacing for mobile */
    .p-6 {
        padding: 1rem;
    }

    .p-8 {
        padding: 1.25rem;
    }
}

/* Dark mode toggle */
#darkModeToggle {
    background-color: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#darkModeToggle:hover {
    color: var(--text-primary);
    background-color: var(--input-bg);
}

/* Form group spacing */
.form-group {
    margin-bottom: 1.5rem;
}

/* Labels */
label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Required field indicator */
label[required]::after {
    content: ' *';
    color: var(--danger-color);
}

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

/* Progress bars */
.progress-bar {
    height: 0.5rem;
    background-color: var(--input-bg);
    border-radius: 9999px;
    overflow: hidden;
}

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

/* Month selector */
#monthSelector {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

#monthSelector:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Chart tooltips */
.chartjs-tooltip {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem !important;
    color: var(--text-primary) !important;
    padding: 0.5rem !important;
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    nav, button {
        display: none;
    }

    .ml-64 {
        margin-left: 0;
    }

    .bg-gray-800 {
        background: white;
        border: 1px solid #eee;
    }
}

/* Loading animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Improved hover effects */
.transaction-item {
    transition: all 0.3s ease;
}

.transaction-item:hover {
    transform: translateX(8px) scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Smooth transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* Chart container responsiveness */
.h-\[400px\] {
    height: 400px;
    max-height: 60vh;
}

@media (max-width: 480px) {
    .h-\[400px\] {
        height: 300px;
    }
}

/* Improved form elements */
input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    transition: all 0.2s ease;
}

/* Better notification positioning for mobile */
@media (max-width: 640px) {
    .notification {
        left: 1rem;
        right: 1rem;
        top: 1rem;
    }
}
