@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    font-family: 'Inter', sans-serif;
}

body {
    background: #000000;
    color: #f5f5f5;
    min-height: 100vh;
}

/* Animation delay classes for cards */
.animation-delay-01 {
    animation-delay: 0.1s;
}

.animation-delay-02 {
    animation-delay: 0.2s;
}

.animation-delay-03 {
    animation-delay: 0.3s;
}

.animation-delay-04 {
    animation-delay: 0.4s;
}

.animation-delay-05 {
    animation-delay: 0.5s;
}

.animation-delay-06 {
    animation-delay: 0.6s;
}

/* Progress bar initial state */
.progress-bar-initial {
    width: 0%;
}

/* Transaction Toggle Styles */
.transaction-toggle-container {
    width: 100%;
}

.transaction-toggle {
    position: relative;
    width: 100%;
    height: 60px;
    border: 2px solid rgba(230, 126, 34, 0.3);
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1610 0%, #2d2416 100%);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.transaction-toggle:focus {
    border-color: rgba(230, 126, 34, 0.6);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

.toggle-background {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 8px;
    overflow: hidden;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.transaction-toggle[data-type="expense"] .toggle-slider {
    left: 50%;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.toggle-labels {
    position: relative;
    display: flex;
    height: 100%;
    z-index: 2;
}

.toggle-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 14px;
}

.toggle-label.active {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.toggle-label i {
    font-size: 16px;
}

.income-label i {
    color: #16a34a;
}

.expense-label i {
    color: #dc2626;
}

.toggle-label.active .income-label i,
.transaction-toggle[data-type="income"] .income-label.active i {
    color: white;
}

.toggle-label.active .expense-label i,
.transaction-toggle[data-type="expense"] .expense-label.active i {
    color: white;
}

/* Mobile optimization for toggle */
@media (max-width: 640px) {
    .transaction-toggle {
        height: 56px;
    }
    
    .toggle-label {
        font-size: 13px;
        gap: 6px;
    }
    
    .toggle-label i {
        font-size: 14px;
    }
    
    .label-text {
        display: none;
    }
    
    .toggle-label i {
        font-size: 18px;
    }
}

/* Hover effects for desktop */
@media (min-width: 768px) {
    .transaction-toggle:hover {
        border-color: rgba(230, 126, 34, 0.5);
        transform: translateY(-1px);
    }
}

/* Transaction list scrolling */
.transactions-scroll-container {
    max-height: 520px; /* Примерно 8 строк по 65px */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for transactions */
.transactions-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.transactions-scroll-container::-webkit-scrollbar-track {
    background: rgba(230, 126, 34, 0.1);
    border-radius: 4px;
}

.transactions-scroll-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(230, 126, 34, 0.6) 0%, rgba(230, 126, 34, 0.4) 100%);
    border-radius: 4px;
}

.transactions-scroll-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(230, 126, 34, 0.8) 0%, rgba(230, 126, 34, 0.6) 100%);
}

/* Firefox scrollbar */
.transactions-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 126, 34, 0.6) rgba(230, 126, 34, 0.1);
}

/* Mobile optimization for scroll container */
@media (max-width: 640px) {
    .transactions-scroll-container {
        max-height: 450px; /* Меньше для мобильных */
    }
    
    .transactions-scroll-container::-webkit-scrollbar {
        width: 6px;
    }
}

/* Smooth scrolling behavior */
.transactions-scroll-container {
    scroll-behavior: smooth;
}

/* Table row height consistency */
.table-row {
    height: 65px;
}

/* Hidden file input */
.hidden-file-input {
    display: none;
}

/* Header glass effect */
.header-glass {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-gradient {
    background: linear-gradient(135deg, #2d2416 0%, #3d2f1f 50%, #4d3f2f 100%);
    border-bottom: 2px solid rgba(230, 126, 34, 0.3);
}

.card-shadow {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.hover-scale {
    transition: all 0.3s ease;
}

.hover-scale:hover {
    transform: none;
    box-shadow: none;
}

.income-gradient {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.expense-gradient {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.profit-gradient {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.glass-effect {
    background: rgba(230, 126, 34, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(230, 126, 34, 0.2);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #2d2416;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #e67e22;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #d35400;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1610 0%, #2d2416 100%);
    border: 1px solid rgba(230, 126, 34, 0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(230, 126, 34, 0.5), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.metric-card {
    background: linear-gradient(135deg, #1a1610 0%, #2d2416 100%);
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.metric-card:hover {
    background: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: none;
    box-shadow: none;
}

.table-row {
    transition: all 0.2s ease;
}

.table-row:hover {
    background-color: transparent;
    transform: none;
}

/* Table row hover effects - выделение записи как в analytics.html */
tbody tr {
    transition: all 0.2s ease;
    cursor: pointer;
}

tbody tr:hover {
    background-color: rgba(230, 126, 34, 0.1) !important;
    border-left: 4px solid rgba(230, 126, 34, 0.8);
    border-right: 4px solid rgba(230, 126, 34, 0.8);
    transform: none !important;
    box-shadow: inset 0 0 20px rgba(230, 126, 34, 0.15);
}

/* Specific table hover effects for transactions */
#transactionsList tr:hover,
#periodTransactionsList tr:hover {
    background-color: rgba(230, 126, 34, 0.1) !important;
    border-left: 4px solid rgba(230, 126, 34, 0.8);
    border-right: 4px solid rgba(230, 126, 34, 0.8);
    transform: none !important;
    box-shadow: inset 0 0 20px rgba(230, 126, 34, 0.15);
}

/* Remove any black hover effects from table elements */
table th:hover,
table td:hover,
table tbody:hover,
table thead:hover {
    background-color: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
}

/* Ensure no Tailwind hover classes override our styles */
.hover\\:bg-gray-50:hover,
.hover\\:bg-gray-100:hover,
.hover\\:bg-gray-200:hover,
.hover\\:bg-black:hover,
.hover\\:bg-slate-50:hover,
.hover\\:bg-slate-100:hover {
    background-color: transparent !important;
}

/* Ensure table cells inherit the row hover state */
tbody tr:hover td {
    background-color: inherit !important;
    color: inherit !important;
}

.delete-btn {
    transition: all 0.2s ease;
}

.delete-btn:hover {
    transform: scale(1.2);
    color: #e74c3c;
}

.progress-bar {
    transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.notification {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

input, select, textarea {
    background-color: #2d2416;
    border-color: rgba(230, 126, 34, 0.3);
    color: #f5f5f5;
}

input:focus, select:focus, textarea:focus {
    border-color: #e67e22;
    background-color: #3d2f1f;
}

table {
    color: #f5f5f5;
}

.empty-state {
    color: #a0a0a0;
}

.header-icon {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.2) 0%, rgba(211, 84, 0, 0.2) 100%);
}

/* Currency modal styles */
#currencyModal {
    backdrop-filter: blur(8px);
}

#currencyModal .metric-card {
    cursor: pointer;
    border: 2px solid transparent;
}

#currencyModal .metric-card:hover {
    border-color: inherit;
    transform: none;
}

#currencyModal .grid {
    scrollbar-width: thin;
    scrollbar-color: #e67e22 #2d2416;
}

#currencyModal .grid::-webkit-scrollbar {
    width: 8px;
}

#currencyModal .grid::-webkit-scrollbar-track {
    background: #2d2416;
    border-radius: 10px;
}

#currencyModal .grid::-webkit-scrollbar-thumb {
    background: #e67e22;
    border-radius: 10px;
}

#currencyModal .grid::-webkit-scrollbar-thumb:hover {
    background: #d35400;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    /* Compact header */
    .header-gradient .container {
        padding: 1rem;
    }
    
    /* Smaller cards padding */
    .stat-card, .metric-card {
        padding: 1rem !important;
    }
    
    /* Stack form elements */
    #transactionForm {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Better table scrolling */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Touch-friendly buttons */
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Modal adjustments */
    #infoModal .metric-card,
    #currencyModal .metric-card {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    /* Currency grid on mobile */
    #currencyModal .grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* Larger touch targets for currency selection */
    #currencyModal .metric-card {
        padding: 1rem;
        min-height: 60px;
    }
    
    /* Improve mobile viewport handling */
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        touch-action: manipulation;
    }
    
    /* Enhanced mobile scrolling */
    html {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Better mobile form inputs */
    input[type="number"] {
        -webkit-appearance: none;
        -moz-appearance: textfield;
        appearance: none;
        font-size: 16px;
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    /* Mobile-specific button improvements */
    button, .btn-primary, a[href] {
        -webkit-tap-highlight-color: rgba(230, 126, 34, 0.3);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Better touch feedback */
    button:active, .btn-primary:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Prevent zoom on form focus */
    input, select, textarea {
        font-size: 16px;
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Mobile table improvements */
    table {
        font-size: 14px;
        border-collapse: separate;
        border-spacing: 0 4px;
    }
    
    table th, table td {
        padding: 8px 12px;
        white-space: nowrap;
    }
    
    /* Better modal positioning on mobile */
    .fixed.inset-0 {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
    }
    
    /* Mobile-friendly modal content */
    .max-w-2xl, .max-w-4xl {
        max-width: calc(100vw - 2rem);
        width: 100%;
    }
    
    /* Improved mobile stats display */
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        gap: 1rem;
    }
    
    /* Better mobile form layout */
    .sm\\:col-span-2 {
        grid-column: span 1;
    }
    
    /* Enhanced mobile navigation */
    .flex.items-center.space-x-1 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    
    /* Swipe gesture support */
    .custom-scrollbar {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    /* Mobile-optimized text selection */
    .break-all {
        word-break: break-all;
        overflow-wrap: break-word;
        -webkit-hyphens: auto;
        hyphens: auto;
    }
    
    /* Better mobile accessibility */
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Two-column layout for forms */
    #transactionForm {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #transactionForm .lg\\:col-span-2 {
        grid-column: span 2;
    }
    
    /* Currency grid on tablets */
    #currencyModal .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Improved hover states for touch devices */
@media (hover: none) and (pointer: coarse) {
    .hover-scale:hover {
        transform: none;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    }
    
    .btn-primary:hover {
        transform: none;
        box-shadow: none;
    }
    
    .delete-btn:hover {
        transform: none;
        color: inherit;
    }
    
    .table-row:hover {
        background-color: transparent;
        transform: none;
    }
}

/* Better focus states for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #e67e22;
    outline-offset: 2px;
}

/* Improved text readability */
@media (max-width: 640px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Ensure minimum text sizes */
    .text-xs {
        font-size: 12px;
    }
    
    .text-sm {
        font-size: 14px;
    }
    
    /* Better spacing for mobile */
    .space-x-1 > * + * {
        margin-left: 0.25rem;
    }
    
    .space-x-2 > * + * {
        margin-left: 0.5rem;
    }
}

/* Loading and animation performance */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .hover-scale,
    .pulse-animation,
    .progress-bar,
    .notification {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stat-card,
    .metric-card {
        border: 2px solid #e67e22;
    }
    
    .glass-effect {
        background: rgba(230, 126, 34, 0.2);
        border: 1px solid #e67e22;
    }
}

/* Dark mode adjustments (for system dark mode) */
@media (prefers-color-scheme: dark) {
    /* Already optimized for dark theme */
}

/* Delete button styles */
.glass-effect:has(.fa-trash-can) {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

.glass-effect:has(.fa-trash-can):hover {
    background: inherit;
    border-color: inherit;
}

/* Delete confirmation modal styles */
#deleteConfirmModal .metric-card {
    background: linear-gradient(135deg, #1a1610 0%, #2d2416 100%);
    border: 2px solid rgba(220, 38, 38, 0.3);
}

#deleteConfirmModal button:last-child {
    transition: all 0.3s ease;
}

#deleteConfirmModal button:last-child:hover {
    transform: none;
    box-shadow: none;
}

/* Improved button tooltips */
button[title] {
    position: relative;
}

/* Mobile adjustments for new buttons */
@media (max-width: 640px) {
    .glass-effect {
        min-width: 44px;
        padding: 0.5rem;
    }
    
    #deleteConfirmModal .flex-col {
        flex-direction: column;
    }
    
    #deleteConfirmModal button {
        width: 100%;
        padding: 0.75rem;
    }
}

/* Export/Import button styles */
.glass-effect:has(.fa-download) {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.glass-effect:has(.fa-download):hover {
    background: inherit;
    border-color: inherit;
}

.glass-effect:has(.fa-upload) {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.glass-effect:has(.fa-upload):hover {
    background: inherit;
    border-color: inherit;
}

.glass-effect:has(.fa-arrows-rotate) {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
}

.glass-effect:has(.fa-arrows-rotate):hover {
    background: inherit;
    border-color: inherit;
}

/* Data transfer modal styles */
#dataTransferModal .metric-card {
    background: linear-gradient(135deg, #1a1610 0%, #2d2416 100%);
    border: 2px solid rgba(168, 85, 247, 0.3);
}

/* Header buttons responsive adjustments */
@media (max-width: 640px) {
    .glass-effect {
        padding: 0.5rem 0.375rem;
        min-width: 36px;
    }
    
    .glass-effect span {
        display: none !important;
    }
    
    /* Show spans in mobile menu */
    #mobileMenu .glass-effect span {
        display: block !important;
    }
}

@media (max-width: 480px) {
    .flex.items-center.space-x-1 {
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .glass-effect {
        padding: 0.375rem;
        min-width: 32px;
    }
    
    /* Ultra-compact mode for very small screens */
    .header-gradient {
        padding: 0.5rem 0;
    }
    
    .header-gradient .container {
        padding: 0.5rem;
    }
    
    .header-gradient h1 {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .header-gradient p {
        font-size: 0.625rem;
        line-height: 1;
    }
    
    /* Compact statistics cards */
    .stat-card {
        padding: 0.75rem !important;
    }
    
    .stat-card h3 {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem;
    }
    
    .stat-card .text-xs {
        font-size: 0.625rem;
    }
    
    /* Simplified form layout */
    #transactionForm {
        gap: 0.75rem;
    }
    
    #transactionForm input,
    #transactionForm select {
        padding: 0.5rem 0.75rem;
        font-size: 14px;
    }
    
    /* Compact table */
    table th,
    table td {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    /* Smaller modals */
    .metric-card {
        padding: 0.75rem !important;
        border-radius: 1rem;
    }
    
    /* Reduce spacing */
    .space-y-4 > * + * {
        margin-top: 0.75rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem;
    }
    
    /* Ultra-compact currency grid */
    #currencyModal .metric-card {
        padding: 0.5rem;
        min-height: 48px;
        font-size: 14px;
    }
    
    /* Smaller icons */
    .header-icon {
        padding: 0.5rem;
    }
    
    .header-icon i {
        font-size: 1.25rem !important;
    }
    
    /* Better mobile scrolling performance */
    .overflow-x-auto,
    .overflow-y-auto {
        will-change: scroll-position;
        contain: layout style paint;
    }
}

/* Better spacing for header buttons */
@media (min-width: 1280px) {
    .xl\\:inline {
        display: inline !important;
    }
}

/* Advanced Sync button styles */
.glass-effect:has(.fa-sync-alt) {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.glass-effect:has(.fa-sync-alt):hover {
    background: inherit;
    border-color: inherit;
}

/* Profile button styles */
.glass-effect:has(.fa-user-circle) {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.glass-effect:has(.fa-user-circle):hover {
    background: inherit;
    border-color: inherit;
}

.glass-effect:has(.fa-users) {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.glass-effect:has(.fa-users):hover {
    background: inherit;
    border-color: inherit;
}

/* Sync key display styles */
#currentSyncKey {
    word-break: break-all;
    user-select: all;
    cursor: text;
}

/* Countdown timer styling */
#keyExpiration {
    font-weight: bold;
    color: #fbbf24;
}

/* Import key input */
#importSyncKey {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

#importSyncKey:focus {
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

/* Generate key button animation */
@keyframes pulse-indigo {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
}

#generateKeyBtn:hover {
    animation: none;
}

/* Advanced sync modal specific styles */
#advancedSyncModal .modal-content {
    background: linear-gradient(145deg, #1a1610 0%, #2d2416 100%);
    border: 2px solid rgba(99, 102, 241, 0.2);
}

#advancedSyncModal .modal-header {
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

/* File input styling */
#importFileInput {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Profile modal styles */
#profileModal .profile-item {
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

#profileModal .profile-item:hover {
    border-color: rgba(99, 102, 241, 0.5);
    transform: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

#profileManagementModal .metric-card {
    background: linear-gradient(135deg, #1a1610 0%, #2d2416 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Profile selection animations */
.profile-item {
    transition: all 0.2s ease;
}

.profile-item:active {
    transform: scale(0.98);
}

/* Profile create form styles */
#profileName {
    background-color: #2d2416;
    border-color: rgba(99, 102, 241, 0.3);
    color: #f5f5f5;
}

#profileName:focus {
    border-color: #6366f1;
    background-color: #3d2f1f;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Active profile badge */
.active-profile-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    animation: pulse 2s infinite;
}

/* Profile icon in header */
#profileIcon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Mobile profile button adjustments */
@media (max-width: 640px) {
    #profileModal .profile-item {
        min-height: 60px;
        padding: 1rem;
    }
    
    #profileManagementModal .metric-card {
        padding: 0.75rem;
    }
    
    .profile-item i {
        font-size: 1rem;
    }
}

/* Progress indication for file operations */
.file-operation-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    z-index: 1000;
}

/* Available periods collapsible section */
#periodsToggleIcon {
    transition: transform 0.3s ease;
}

#periodsContainer {
    transition: all 0.3s ease;
}

#periodsContainer.hidden {
    display: none;
}

#periodsContainer:not(.hidden) {
    display: block;
}

/* Custom scrollbar for periods */
#availablePeriods {
    scrollbar-width: thin;
    scrollbar-color: rgba(251, 191, 36, 0.3) rgba(0, 0, 0, 0.1);
}

#availablePeriods::-webkit-scrollbar {
    width: 6px;
}

#availablePeriods::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

#availablePeriods::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.3);
    border-radius: 3px;
}

#availablePeriods::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.5);
}

/* Periods count badge */
#periodsCount {
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* Period button hover effects */
#availablePeriods button:hover {
    box-shadow: none;
}

/* Toggle button hover effect */
button[onclick="toggleAvailablePeriods()"]:hover {
    background: inherit;
}

/* Smooth animations for period selection */
#availablePeriods button {
    transition: all 0.2s ease;
}

#availablePeriods button:active {
    transform: scale(0.98);
}

/* Additional mobile performance optimizations */
@media (max-width: 640px) {
    /* GPU acceleration for smooth animations */
    .fade-in,
    .hover-scale,
    .btn-primary,
    .stat-card {
        will-change: transform;
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Optimize rendering */
    .metric-card,
    .stat-card {
        contain: layout style paint;
    }
    
    /* Better font rendering on mobile */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    /* Reduce motion for better performance */
    @media (prefers-reduced-motion: no-preference) {
        .fade-in {
            animation-duration: 0.3s;
        }
        
        .hover-scale {
            transition-duration: 0.2s;
        }
    }
    
    /* Better mobile table performance */
    table {
        table-layout: fixed;
        width: 100%;
    }
    
    /* Optimize background gradients for mobile */
    .header-gradient,
    .stat-card,
    .metric-card {
        background-attachment: scroll;
    }
    
    /* Mobile-specific input optimizations */
    input:focus,
    select:focus,
    textarea:focus {
        transform: none;
        transition: border-color 0.15s ease;
    }
    
    /* Better mobile modal performance */
    .fixed.inset-0 {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Optimize backdrop blur for mobile */
    .backdrop-blur-sm {
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }
}

/* iPhone specific optimizations */
@supports (-webkit-touch-callout: none) {
    /* iPhone safe area handling */
    .header-gradient {
        padding-top: max(1.5rem, env(safe-area-inset-top));
    }
    
    /* Prevent zoom on double tap */
    * {
        touch-action: manipulation;
    }
    
    /* Better iOS form styling */
    input, select, textarea {
        -webkit-appearance: none;
        border-radius: 0.75rem;
    }
    
    /* iOS specific button improvements */
    button {
        -webkit-appearance: none;
        border-radius: 0.75rem;
    }
}

/* Android specific optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
    /* Android Chrome specific fixes */
    input[type="number"] {
        -webkit-appearance: none;
    }
    
    /* Better Android scrolling */
    .overflow-x-auto,
    .overflow-y-auto {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .overflow-x-auto::-webkit-scrollbar,
    .overflow-y-auto::-webkit-scrollbar {
        display: none;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 640px) and (orientation: landscape) {
    /* Compact header in landscape */
    .header-gradient {
        padding: 0.5rem 0;
    }
    
    .header-gradient .container {
        padding: 0.5rem 1rem;
    }
    
    /* Better use of horizontal space */
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    /* Horizontal form layout in landscape */
    #transactionForm {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    /* Compact modals in landscape */
    .max-h-\5B 90vh\5D {
        max-height: 85vh;
    }
}

/* PWA-specific optimizations */
@media (display-mode: standalone) {
    /* PWA mode adjustments */
    .header-gradient {
        padding-top: max(1.5rem, env(safe-area-inset-top, 1.5rem));
    }
    
    /* Better PWA modal handling */
    .fixed.inset-0 {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* Dark theme mobile optimizations */
@media (prefers-color-scheme: dark) and (max-width: 640px) {
    /* Enhanced contrast for mobile dark mode */
    .stat-card,
    .metric-card {
        border-color: rgba(230, 126, 34, 0.4);
    }
    
    /* Better text contrast on mobile */
    body {
        color: #fafafa;
    }
    
    /* Improved mobile focus states */
    button:focus,
    input:focus,
    select:focus {
        outline-color: #f59e0b;
        box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
    }
}

/* Mobile Burger Menu Styles */
#mobileMenu {
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu-item {
    min-height: 80px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.mobile-menu-item:active {
    transform: scale(0.95);
}

.mobile-menu-item:hover {
    transform: none;
    box-shadow: none;
}

/* Mobile menu animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* Burger icon animation */
#burgerIcon {
    transition: transform 0.3s ease;
}

#burgerIcon.fa-times {
    transform: rotate(90deg);
}

/* Mobile menu backdrop */
#mobileMenu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(26, 22, 16, 0.95) 0%, rgba(45, 36, 22, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0;
    z-index: -1;
}

/* Enhanced mobile menu item styling */
.mobile-menu-item i {
    transition: all 0.2s ease;
}

.mobile-menu-item:hover i {
    transform: none;
}

/* Mobile menu responsive adjustments */
@media (max-width: 480px) {
    .mobile-menu-item {
        min-height: 70px;
        padding: 0.75rem;
    }
    
    .mobile-menu-item i {
        font-size: 1rem;
    }
    
    .mobile-menu-item span {
        font-size: 0.75rem;
    }
}

/* Mobile menu grid adjustments for small screens */
@media (max-width: 380px) {
    #mobileMenu .grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .mobile-menu-item.col-span-2 {
        grid-column: span 1;
    }
}

/* Enhanced touch feedback for mobile menu */
@media (hover: none) and (pointer: coarse) {
    .mobile-menu-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .mobile-menu-item:active {
        background-color: rgba(255, 255, 255, 0.1);
        transform: scale(0.98);
    }
}

/* Mobile menu accessibility improvements */
.mobile-menu-item:focus {
    outline: 2px solid #e67e22;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.2);
}

/* Mobile menu safe area support */
@supports (padding: max(0px)) {
    #mobileMenu {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Vertical Mobile Menu Styles */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Vertical mobile menu container */
#mobileMenu .flex.flex-col.overflow-y-auto {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    max-height: 320px;
}

/* Mobile menu items for vertical list */
#mobileMenu .mobile-menu-item {
    width: 100%;
    min-height: 60px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    border-radius: 0.75rem;
}

/* Improved spacing for vertical menu */
#mobileMenu .flex.space-y-3 > * + * {
    margin-top: 0.75rem;
}

/* Better text sizing for vertical layout */
#mobileMenu .mobile-menu-item .text-sm {
    font-size: 0.875rem;
    line-height: 1.3;
    font-weight: 500;
}

#mobileMenu .mobile-menu-item .text-xs {
    font-size: 0.75rem;
    line-height: 1.2;
    opacity: 0.8;
}

/* Icons in vertical menu */
#mobileMenu .mobile-menu-item i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

/* Enhanced touch feedback for vertical menu */
#mobileMenu .mobile-menu-item:active {
    transform: scale(0.98);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Hover effects for vertical menu */
#mobileMenu .mobile-menu-item:hover {
    transform: none;
    box-shadow: none;
}

/* Text alignment for vertical menu */
#mobileMenu .mobile-menu-item .flex.flex-col {
    text-align: left;
    align-items: flex-start;
}

/* Responsive adjustments for vertical menu */
@media (max-width: 480px) {
    #mobileMenu .mobile-menu-item {
        min-height: 56px;
        padding: 0.75rem;
    }
    
    #mobileMenu .mobile-menu-item .text-sm {
        font-size: 0.8125rem;
    }
    
    #mobileMenu .mobile-menu-item .text-xs {
        font-size: 0.6875rem;
    }
    
    #mobileMenu .mobile-menu-item i {
        font-size: 1rem;
    }
    
    #mobileMenu .flex.space-y-3 > * + * {
        margin-top: 0.5rem;
    }
}

@media (max-width: 380px) {
    #mobileMenu .mobile-menu-item {
        min-height: 52px;
        padding: 0.625rem;
    }
    
    #mobileMenu .mobile-menu-item .text-sm {
        font-size: 0.75rem;
    }
    
    #mobileMenu .mobile-menu-item .text-xs {
        font-size: 0.625rem;
        line-height: 1.1;
    }
    
    #mobileMenu .flex.space-y-3 > * + * {
        margin-top: 0.375rem;
    }
}

/* Performance optimizations for vertical scroll */
#mobileMenu .flex.overflow-y-auto {
    will-change: scroll-position;
    contain: layout style paint;
}

/* Accessibility improvements for vertical menu */
#mobileMenu .mobile-menu-item:focus {
    outline: 2px solid #e67e22;
    outline-offset: 2px;
    z-index: 2;
}

/* Smooth transitions for vertical menu */
#mobileMenu .mobile-menu-item {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

/* Enhanced visual feedback for touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobileMenu .mobile-menu-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    #mobileMenu .mobile-menu-item:active {
        background-color: rgba(255, 255, 255, 0.15);
        transform: scale(0.98);
    }
}

/* Better button layout for vertical menu */
#mobileMenu .mobile-menu-item .flex.items-center {
    align-items: center;
    gap: 0.75rem;
}

/* Description text styling */
#mobileMenu .mobile-menu-item .flex.flex-col span:last-child {
    color: rgba(255, 255, 255, 0.6);
}

/* Max height management for many items */
#mobileMenu .max-h-80 {
    max-height: 20rem;
}

/* Fade effect at bottom when scrollable */
#mobileMenu .flex.flex-col.overflow-y-auto::after {
    content: '';
    position: sticky;
    bottom: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(26, 22, 16, 0.95));
    pointer-events: none;
    margin-top: -20px;
}

/* Hide fade effect when not scrollable */
#mobileMenu .flex.flex-col:not(.overflow-y-auto)::after {
    display: none;
}

/* Support Button Floating Styles */
.support-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.4);
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
    text-decoration: none;
}

/* SVG styles for support button */
.support-button svg {
    width: 24px;
    height: 24px;
    fill: white;
    transition: all 0.3s ease;
}

.support-button:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.4);
}

.support-button:active {
    transform: scale(0.95);
}

/* Mobile adjustments for support button */
@media (max-width: 640px) {
    .support-button {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
        font-size: 20px;
    }
}

/* Prevent support button from interfering with content */
body {
    padding-bottom: 80px;
}

@media (max-width: 640px) {
    body {
        padding-bottom: 72px;
    }
}

/* Accessibility improvements for support button */
.support-button:focus {
    outline: 3px solid rgba(230, 126, 34, 0.5);
    outline-offset: 2px;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .support-button:hover {
        transform: none;
    }
    
    .support-button:active {
        background: linear-gradient(135deg, #d35400 0%, #b8450f 100%);
        transform: scale(0.95);
    }
}

/* Modal windows color overrides - change orange to black */
#infoModal .metric-card,
#currencyModal .metric-card,
#deleteConfirmModal .metric-card,
#dataTransferModal .metric-card,
#advancedSyncModal .metric-card,
#profileManagementModal .metric-card {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%) !important;
    border-color: rgba(0, 0, 0, 0.5) !important;
}

/* Modal text color overrides */
#infoModal .text-orange-100,
#currencyModal .text-orange-200,
#deleteConfirmModal .text-orange-200,
#dataTransferModal .text-orange-100,
#advancedSyncModal .text-orange-200 {
    color: rgb(229, 231, 235) !important;
}

#infoModal .text-orange-200,
#currencyModal .text-orange-300,
#deleteConfirmModal .text-orange-300,
#dataTransferModal .text-orange-200,
#advancedSyncModal .text-orange-300 {
    color: rgb(209, 213, 219) !important;
}

#infoModal .text-orange-300,
#dataTransferModal .text-orange-300 {
    color: rgb(156, 163, 175) !important;
}

/* Modal icon color overrides */
#infoModal .text-orange-400,
#currencyModal .text-orange-400,
#deleteConfirmModal .text-orange-400,
#dataTransferModal .text-orange-400,
#advancedSyncModal .text-orange-400 {
    color: rgb(156, 163, 175) !important;
}

/* Modal background overrides */
#infoModal .bg-orange-900\/30,
#currencyModal .bg-orange-900\/30,
#deleteConfirmModal .bg-orange-900\/30,
#dataTransferModal .bg-orange-900\/30,
#advancedSyncModal .bg-orange-900\/30 {
    background-color: rgba(0, 0, 0, 0.4) !important;
}

/* Modal border overrides */
#infoModal .border-orange-900\/30,
#currencyModal .border-orange-900\/30,
#deleteConfirmModal .border-orange-900\/30,
#dataTransferModal .border-orange-900\/30,
#advancedSyncModal .border-orange-900\/30 {
    border-color: rgba(0, 0, 0, 0.5) !important;
}

/* Highlighted year and month styles */
input#quickYear.has-data-year {
    background: rgba(34, 197, 94, 0.2) !important;
    border: 2px solid rgba(34, 197, 94, 0.6) !important;
    color: rgb(34, 197, 94) !important;
    font-weight: 600 !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1) !important;
}

/* Remove selector highlighting - only highlight options */

input#quickYear.has-data-year:hover {
    background: rgba(34, 197, 94, 0.3) !important;
    border-color: rgba(34, 197, 94, 0.8) !important;
    transform: scale(1.02);
}

input#quickYear.has-data-year:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;
    outline: none !important;
}

/* Option highlighting for months with data */
select#quickMonth option.has-data-month {
    background-color: rgba(34, 197, 94, 0.8) !important;
    color: white !important;
    font-weight: bold !important;
}

/* Mobile Transactions Cards */
.transactions-mobile-container {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 126, 34, 0.3) rgba(0, 0, 0, 0.1);
}

.transactions-mobile-container::-webkit-scrollbar {
    width: 4px;
}

.transactions-mobile-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.transactions-mobile-container::-webkit-scrollbar-thumb {
    background: rgba(230, 126, 34, 0.3);
    border-radius: 2px;
}

.transactions-mobile-container::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 126, 34, 0.5);
}

.transaction-mobile-card {
    background: linear-gradient(135deg, rgba(26, 22, 16, 0.8) 0%, rgba(45, 36, 22, 0.6) 100%);
    border: 1px solid rgba(230, 126, 34, 0.2);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    position: relative;
}

.transaction-mobile-card:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(26, 22, 16, 0.9) 0%, rgba(45, 36, 22, 0.8) 100%);
}

.transaction-mobile-card.income {
    border-left: 4px solid #22c55e;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(26, 22, 16, 0.8) 20%);
}

.transaction-mobile-card.expense {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(26, 22, 16, 0.8) 20%);
}

.transaction-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.transaction-mobile-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transaction-mobile-type.income {
    color: #22c55e;
}

.transaction-mobile-type.expense {
    color: #ef4444;
}

.transaction-mobile-amount {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    text-align: right;
}

.transaction-mobile-amount.income {
    color: #22c55e;
}

.transaction-mobile-amount.expense {
    color: #ef4444;
}

.transaction-mobile-note {
    color: #f3f4f6;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
    word-break: break-word;
}

.transaction-mobile-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #9ca3af;
}

.transaction-mobile-date {
    flex: 1;
}

.transaction-mobile-delete {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    color: #ef4444;
    font-size: 10px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    cursor: pointer;
}

.transaction-mobile-delete:active {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(0.95);
}

.transaction-mobile-delete:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Enhanced mobile scrolling for transactions */
@media (max-width: 640px) {
    .transactions-mobile-container {
        max-height: 320px;
        padding: 8px;
    }
    
    .transaction-mobile-card {
        padding: 10px;
        border-radius: 10px;
    }
    
    .transaction-mobile-amount {
        font-size: 15px;
    }
    
    .transaction-mobile-note {
        font-size: 12px;
    }
    
    .transaction-mobile-footer {
        font-size: 10px;
    }
    
    .transaction-mobile-delete {
        padding: 3px 6px;
        font-size: 9px;
    }
}

/* Ultra-compact mobile cards for very small screens */
@media (max-width: 380px) {
    .transactions-mobile-container {
        max-height: 280px;
        padding: 6px;
    }
    
    .transaction-mobile-card {
        padding: 8px;
        border-radius: 8px;
    }
    
    .transaction-mobile-amount {
        font-size: 14px;
    }
    
    .transaction-mobile-note {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .transaction-mobile-type {
        font-size: 11px;
    }
    
    .transaction-mobile-footer {
        font-size: 9px;
    }
    
    .transaction-mobile-delete {
        padding: 2px 4px;
        font-size: 8px;
    }
}

/* Performance optimizations for mobile cards */
.transaction-mobile-card {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    contain: layout style paint;
}

/* Accessibility improvements */
.transaction-mobile-delete:focus {
    outline: 2px solid #ef4444;
    outline-offset: 1px;
}

/* Touch feedback enhancement */
@media (hover: none) and (pointer: coarse) {
    .transaction-mobile-card:hover {
        transform: none;
    }
    
    .transaction-mobile-delete:hover {
        background: rgba(239, 68, 68, 0.1);
    }
}

/* Daily Chart Styles */
.chart-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 126, 34, 0.3) rgba(0, 0, 0, 0.1);
}

.chart-container::-webkit-scrollbar {
    height: 6px;
}

.chart-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chart-container::-webkit-scrollbar-thumb {
    background: rgba(230, 126, 34, 0.3);
    border-radius: 3px;
}

.chart-container::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 126, 34, 0.5);
}

.daily-chart-content {
    min-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-day-row {
    display: flex;
    align-items: center;
    min-height: 40px;
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 4px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.15);
    position: relative;
}

.chart-day-row:last-child {
    border-bottom: none;
}

.chart-day-row:nth-child(even) {
    background: rgba(251, 191, 36, 0.02);
}

.chart-day-row:hover {
    background: rgba(230, 126, 34, 0.05);
    transform: translateX(2px);
    border-bottom-color: rgba(251, 191, 36, 0.3);
}

.chart-day-label {
    width: 80px;
    font-size: 12px;
    font-weight: 600;
    color: #d1d5db;
    text-align: center;
    flex-shrink: 0;
    background: rgba(251, 191, 36, 0.08);
    border-radius: 6px;
    padding: 4px 2px;
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-day-label.weekend {
    color: #fbbf24;
}

.chart-day-label.today {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 6px;
    padding: 2px 4px;
}

.chart-bars-container {
    flex: 1;
    position: relative;
    height: 32px;
    margin-left: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(251, 191, 36, 0.1);
    /* Add vertical grid lines */
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 9%,
        rgba(251, 191, 36, 0.1) 10%,
        rgba(251, 191, 36, 0.1) 10%
    );
}

.chart-bar {
    position: absolute;
    top: 0;
    height: 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chart-bar:hover {
    transform: scaleY(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.3);
}

.chart-bar.income {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    top: 2px;
}

.chart-bar.expense {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
    top: 14px;
}

.chart-bar.profit {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    top: 26px;
    height: 6px;
}

.chart-bar.profit.negative {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.chart-values {
    width: 120px;
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    text-align: right;
    flex-shrink: 0;
}

.chart-value {
    line-height: 1.2;
}

.chart-value.income {
    color: #22c55e;
}

.chart-value.expense {
    color: #ef4444;
}

.chart-value.profit {
    color: #3b82f6;
}

.chart-value.profit.negative {
    color: #f59e0b;
}

/* Chart tooltip */
.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.chart-tooltip.visible {
    opacity: 1;
}

/* Empty chart state */
.chart-empty-day {
    opacity: 0.3;
}

.chart-empty-day .chart-day-label {
    color: #6b7280;
}

/* Responsive adjustments for chart */
@media (max-width: 768px) {
    .daily-chart-content {
        min-width: 100%;
        gap: 4px;
    }
    
    .chart-day-row {
        min-height: 44px;
        padding: 6px 0;
        border-bottom-width: 1px;
    }
    
    .chart-day-label {
        width: 50px;
        font-size: 11px;
        padding: 6px 2px;
        margin-right: 8px;
        border-radius: 6px;
    }
    
    .chart-bars-container {
        height: 30px;
        margin-left: 8px;
        margin-right: 8px;
        background-size: 15% 100%, 100% 44px;
    }
    
    .chart-bar {
        height: 8px;
        border-radius: 4px;
    }
    
    .chart-bar.income {
        top: 2px;
    }
    
    .chart-bar.expense {
        top: 11px;
    }
    
    .chart-bar.profit {
        top: 20px;
        height: 6px;
    }
    
    .chart-values {
        width: 90px;
        font-size: 9px;
        gap: 1px;
    }
    
    .chart-value {
        padding: 1px 4px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .chart-container {
        padding: 8px;
        max-height: 350px;
        background-size: 20% 100%, 100% 44px;
    }
    
    .daily-chart-content {
        gap: 2px;
    }
    
    .chart-day-row {
        min-height: 40px;
        padding: 4px 0;
        margin-bottom: 2px;
    }
    
    .chart-day-label {
        width: 42px;
        font-size: 10px;
        padding: 4px 1px;
        margin-right: 6px;
    }
    
    .chart-bars-container {
        height: 26px;
        margin-left: 6px;
        margin-right: 6px;
        background-size: 25% 100%, 100% 40px;
    }
    
    .chart-bar {
        height: 7px;
        border-radius: 3px;
        border-width: 0.5px;
    }
    
    .chart-bar.income {
        top: 2px;
    }
    
    .chart-bar.expense {
        top: 10px;
    }
    
    .chart-bar.profit {
        top: 18px;
        height: 5px;
    }
    
    .chart-values {
        width: 75px;
        font-size: 8px;
        gap: 0.5px;
    }
    
    .chart-value {
        padding: 0.5px 3px;
        font-size: 8px;
        border-radius: 3px;
    }
    
    .chart-tooltip {
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    .chart-container {
        padding: 6px;
        max-height: 300px;
    }
    
    .chart-day-row {
        min-height: 36px;
        padding: 3px 0;
    }
    
    .chart-day-label {
        width: 38px;
        font-size: 9px;
        padding: 3px 1px;
        margin-right: 4px;
    }
    
    .chart-bars-container {
        height: 22px;
        margin-left: 4px;
        margin-right: 4px;
    }
    
    .chart-bar {
        height: 6px;
    }
    
    .chart-bar.income {
        top: 1px;
    }
    
    .chart-bar.expense {
        top: 8px;
    }
    
    .chart-bar.profit {
        top: 15px;
        height: 4px;
    }
    
    .chart-values {
        width: 65px;
        font-size: 7px;
    }
    
    .chart-value {
        padding: 0.5px 2px;
        font-size: 7px;
    }
}

/* Mobile chart header improvements */
@media (max-width: 768px) {
    #dailyChartContent .bg-gradient-to-r {
        padding: 12px 16px !important;
        margin-bottom: 16px !important;
    }
    
    #dailyChartContent h3 {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
    
    #dailyChartContent .flex.items-center.justify-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    #dailyChartContent .flex.items-center.space-x-4 {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
    }
    
    #dailyChartContent .flex.items-center.space-x-2 {
        font-size: 12px !important;
        gap: 6px !important;
    }
    
    #dailyChartContent .w-3.h-3 {
        width: 12px !important;
        height: 12px !important;
    }
}

@media (max-width: 480px) {
    #dailyChartContent .bg-gradient-to-r {
        padding: 8px 12px !important;
        margin-bottom: 12px !important;
    }
    
    #dailyChartContent h3 {
        font-size: 14px !important;
    }
    
    #dailyChartContent .flex.items-center.space-x-4 {
        gap: 6px !important;
    }
    
    #dailyChartContent .flex.items-center.space-x-2 {
        font-size: 11px !important;
        gap: 4px !important;
    }
    
    #dailyChartContent .w-3.h-3 {
        width: 10px !important;
        height: 10px !important;
    }
}

/* Chart legend improvements for mobile */
@media (max-width: 640px) {
    .flex.items-center.space-x-4 {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .flex.items-center.space-x-2 {
        font-size: 11px;
    }
    
    .w-3.h-3 {
        width: 8px;
        height: 8px;
    }
}

/* Performance optimizations for chart */
.chart-bar {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.chart-day-row {
    contain: layout style paint;
}

/* High contrast mode support for chart */
@media (prefers-contrast: high) {
    .chart-bar.income {
        background: #00ff00;
    }
    
    .chart-bar.expense {
        background: #ff0000;
    }
    
    .chart-bar.profit {
        background: #0066ff;
    }
    
    .chart-bar.profit.negative {
        background: #ffaa00;
    }
}

/* Reduced motion support for chart */
@media (prefers-reduced-motion: reduce) {
    .chart-bar,
    .chart-day-row,
    .chart-tooltip {
        transition: none;
    }
    
    .chart-bar:hover {
        transform: none;
    }
    
    .chart-day-row:hover {
        transform: none;
    }
}

/* Dark mode adjustments for chart */
@media (prefers-color-scheme: dark) {
    .chart-container {
        background: rgba(0, 0, 0, 0.4);
    }
    
    .chart-tooltip {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(230, 126, 34, 0.5);
    }
}

/* Chart Toggle Button Mobile Enhancement */
@media (max-width: 480px) {
    /* Better visibility for chart toggle button on mobile */
    #toggleChartBtn {
        padding: 12px 16px !important;
        min-height: 48px !important;
        touch-action: manipulation;
        background: rgba(230, 126, 34, 0.15) !important;
        border: 2px solid rgba(230, 126, 34, 0.4) !important;
    }
    
    #toggleChartBtn i {
        font-size: 16px !important;
        color: #fbbf24 !important;
        text-shadow: 0 0 4px rgba(251, 191, 36, 0.6);
        display: inline-block !important;
        min-width: 18px !important;
        font-weight: 900 !important;
    }
    
    #toggleChartBtn span {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #ffffff !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }
    
    #toggleChartBtn:hover i,
    #toggleChartBtn:focus i,
    #toggleChartBtn:active i {
        color: #f59e0b !important;
        text-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
        transform: scale(1.1);
    }
    
    #toggleChartBtn:active {
        background: rgba(230, 126, 34, 0.25) !important;
        border-color: rgba(230, 126, 34, 0.6) !important;
        transform: scale(0.98);
    }
}

/* Extra enhancement for very small screens */
@media (max-width: 380px) {
    #toggleChartBtn {
        padding: 10px 14px !important;
        min-height: 44px !important;
    }
    
    #toggleChartBtn i {
        font-size: 15px !important;
        text-shadow: 0 0 5px rgba(251, 191, 36, 0.7);
    }
    
    #toggleChartBtn span {
        font-size: 13px !important;
    }
}

/* High contrast mode for toggle button */
@media (prefers-contrast: high) {
    #toggleChartBtn {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 2px solid #fbbf24 !important;
    }
    
    #toggleChartBtn i {
        color: #ffffff !important;
        text-shadow: 0 0 3px #000000;
    }
}