/* Custom styles for Axilogy Ledger */

/* Smooth transitions for theme switching */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, 
                box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

/* Mobile-first responsive design */
@media (max-width: 640px) {
    /* Improve touch targets on mobile */
    .btn {
        min-height: 2.75rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-circle {
        min-height: 2.5rem;
        width: 2.5rem;
    }
    
    .btn-sm {
        min-height: 2rem;
        padding: 0.25rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Better spacing for mobile */
    .modal-box {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Responsive navigation */
    .navbar {
        min-height: 3.5rem;
        padding: 0 0.5rem;
    }
    
    /* Better form controls on mobile */
    .form-control .input,
    .form-control .select,
    .form-control .textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Responsive tables */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .table-responsive table {
        min-width: 700px;
    }
    
    /* Mobile table improvements */
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.875rem;
    }
    
    .table th:first-child,
    .table td:first-child {
        padding-left: 0.5rem;
    }
    
    .table th:last-child,
    .table td:last-child {
        padding-right: 0.5rem;
    }
    
    /* Mobile-friendly cards */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Better stats on mobile */
    .stats {
        grid-template-columns: 1fr;
    }
    
    .stat {
        text-align: center;
        padding: 1rem;
    }
    
    /* Mobile headings */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    /* Toast positioning on mobile */
    .toast-mobile {
        top: 1rem;
        left: 1rem;
        right: 1rem;
        transform: none;
    }
}

/* Tablet improvements */
@media (min-width: 641px) and (max-width: 1024px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-box {
        max-height: calc(100vh - 4rem);
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Desktop and up improvements */
@media (min-width: 1025px) {
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Enhanced theme selector styling */
.theme-selector-btn {
    position: relative;
    overflow: hidden;
}

.theme-selector-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.theme-selector-btn:hover::before {
    left: 100%;
}

/* Theme dropdown improvements */
.theme-dropdown {
    max-height: 24rem;
    overflow-y: auto;
}

/* Better focus indicators for accessibility */
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
    outline: 2px solid hsl(var(--p));
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn,
    .input,
    .select,
    .textarea,
    .card {
        border-width: 2px;
    }
    
    .badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .navbar,
    .modal,
    .dropdown,
    .btn,
    .toast {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .table {
        border-collapse: collapse;
    }
    
    .table th,
    .table td {
        border: 1px solid #ccc;
        padding: 0.5rem;
    }
}

/* Color-safe amount styling */
.amount-positive {
    color: #059669; /* green-600 */
    font-weight: 600;
}

.amount-negative {
    color: #dc2626; /* red-600 */
    font-weight: 600;
}

/* Dark theme amount colors */
[data-theme="dark"] .amount-positive {
    color: #10b981; /* green-500 */
}

[data-theme="dark"] .amount-negative {
    color: #ef4444; /* red-500 */
}

/* Theme-specific enhancements */
[data-theme="synthwave"] .navbar {
    background: linear-gradient(45deg, hsl(var(--p)), hsl(var(--s)));
    backdrop-filter: blur(10px);
}

[data-theme="cyberpunk"] .card {
    border: 1px solid hsl(var(--a));
    box-shadow: 0 0 20px hsl(var(--a) / 0.3);
}

[data-theme="cyberpunk"] .navbar {
    border-bottom: 2px solid hsl(var(--a));
}

[data-theme="valentine"] .stat {
    background: linear-gradient(135deg, hsl(var(--p) / 0.1), hsl(var(--s) / 0.1));
}

[data-theme="halloween"] .card:hover {
    box-shadow: 0 10px 25px hsl(var(--wa) / 0.3);
    transform: translateY(-2px) scale(1.02);
}

[data-theme="forest"] .table-zebra tbody tr:nth-child(even) {
    background-color: hsl(var(--s) / 0.1);
}

[data-theme="luxury"] .btn-primary {
    background: linear-gradient(45deg, hsl(var(--p)), hsl(var(--s)));
    border: none;
    position: relative;
    overflow: hidden;
}

[data-theme="luxury"] .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

[data-theme="luxury"] .btn-primary:hover::before {
    left: 100%;
}

[data-theme="dracula"] .loading-overlay {
    background-color: hsl(var(--b1) / 0.9);
    backdrop-filter: blur(5px);
}

[data-theme="retro"] .badge {
    border-radius: 0.25rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-theme="wireframe"] .card {
    border: 2px solid hsl(var(--bc));
    background: transparent;
}

[data-theme="wireframe"] .btn {
    border: 2px solid hsl(var(--bc));
    background: transparent;
}

[data-theme="black"] .table-zebra tbody tr:hover {
    background-color: hsl(var(--b2));
    transform: scale(1.01);
}

/* Animated theme badges in dropdown */
.theme-dropdown .badge {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-dropdown li:hover .badge {
    transform: scale(1.1);
    box-shadow: 0 0 10px currentColor;
}

/* Special effects for certain themes */
[data-theme="synthwave"] .btn:hover,
[data-theme="cyberpunk"] .btn:hover {
    box-shadow: 0 0 15px hsl(var(--p) / 0.5);
    transform: translateY(-1px);
}

[data-theme="fantasy"] .card {
    background: linear-gradient(135deg, hsl(var(--b1)), hsl(var(--b2)));
    border: 1px solid hsl(var(--p) / 0.2);
}

/* Enhanced loading spinner for different themes */
[data-theme="cyberpunk"] .loading {
    filter: drop-shadow(0 0 5px hsl(var(--p)));
}

[data-theme="synthwave"] .loading {
    filter: drop-shadow(0 0 8px hsl(var(--a)));
}

/* Loading states */
.loading-overlay {
    backdrop-filter: blur(2px);
}

/* Form enhancements */
.form-control:focus-within .label-text {
    color: hsl(var(--p));
}

/* Table enhancements */
.table-zebra tbody tr:hover {
    background-color: hsl(var(--b3));
}

/* Card hover effects */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

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

::-webkit-scrollbar-track {
    background: hsl(var(--b3));
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--bc) / 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--bc) / 0.3);
}

/* Status badges */
.badge-pending {
    @apply badge-warning;
}

.badge-approved {
    @apply badge-success;
}

.badge-rejected {
    @apply badge-error;
}

/* Amount formatting */
.amount-positive {
    @apply text-success font-semibold;
}

.amount-negative {
    @apply text-error font-semibold;
}

.amount-neutral {
    @apply text-base-content font-semibold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
    }
}

/* Improved hover effects across themes */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Theme-aware scrollbars */
[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-theme="black"] ::-webkit-scrollbar-thumb,
[data-theme="dracula"] ::-webkit-scrollbar-thumb,
[data-theme="night"] ::-webkit-scrollbar-thumb {
    background: hsl(var(--bc) / 0.4);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
[data-theme="black"] ::-webkit-scrollbar-thumb:hover,
[data-theme="dracula"] ::-webkit-scrollbar-thumb:hover,
[data-theme="night"] ::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--bc) / 0.6);
}

/* Responsive theme adjustments */
@media (max-width: 768px) {
    .theme-dropdown {
        width: 280px;
        max-height: 400px;
        overflow-y: auto;
    }
}

/* Theme transition effects */
html {
    transition: background-color 0.3s ease;
}

body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .dropdown,
    .modal,
    .toast {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e5e5e5;
    }
    
    /* Force light theme for printing */
    * {
        background-color: white !important;
        color: black !important;
    }
}

/* Recurring transaction specific styles */
.recurring-toggle {
    transition: all 0.3s ease;
}

.recurring-form-section {
    animation: slideDown 0.3s ease-out;
}

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

/* Fix for mobile recurring transaction buttons */
@media (max-width: 640px) {
    .recurring-button-group {
        display: flex;
        gap: 0.5rem;
        width: 100%;
    }
    
    .recurring-button-group > button {
        flex: 1;
    }
}