/* ===============================================
   FINANCECORE PREMIUM UI - 10/10 BANKING GRADE
   =============================================== */

/* === LOADING STATES & SKELETON SCREENS === */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.skeleton-line {
    height: 16px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.skeleton-line.title { height: 24px; width: 60%; }
.skeleton-line.subtitle { height: 16px; width: 40%; }
.skeleton-line.content { height: 14px; width: 100%; }
.skeleton-line.short { width: 30%; }

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

/* === MICRO-INTERACTIONS & ANIMATIONS === */
.btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Nav Item Animations */
.nav-item {
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #4CAF50;
    transform: scaleY(0);
    transition: transform 0.2s ease-in-out;
}

.nav-item:hover::before,
.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item:hover {
    background: rgba(76, 175, 80, 0.1);
    padding-left: 20px;
}

/* Input Focus Animations */
.form-input, .form-select {
    transition: all 0.2s ease-in-out;
    border: 2px solid #e1e5e9;
}

.form-input:focus, .form-select:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    transform: scale(1.01);
}

/* === DARK MODE SUPPORT === */
.app-container[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-card: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #444444;
    --accent-color: #4CAF50;
}

[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .sidebar {
    background-color: var(--bg-secondary);
    border-right-color: var(--border-color);
}

[data-theme="dark"] .main-content {
    background-color: var(--bg-primary);
}

[data-theme="dark"] .form-container,
[data-theme="dark"] .transfer-section {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Dark Mode Toggle */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background: #ddd;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s ease;
    border: none;
    outline: none;
}

.theme-toggle.dark {
    background: #4CAF50;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.theme-toggle.dark::before {
    transform: translateX(30px);
}

/* === ADVANCED 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;
}

.focus-visible {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .nav-item {
        border: 1px solid transparent;
    }
    
    .nav-item:focus,
    .nav-item:hover {
        border-color: currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === BULK ACTIONS UI === */
.bulk-actions-bar {
    position: sticky;
    top: 0;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.bulk-actions-bar.active {
    display: flex;
}

.bulk-actions-info {
    font-weight: 500;
}

.bulk-actions-buttons {
    display: flex;
    gap: 10px;
}

.bulk-action-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.bulk-action-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Checkbox Styling */
.checkbox-container {
    position: relative;
    padding-left: 25px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: #4CAF50;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* === ADVANCED SEARCH UI === */
.advanced-search-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.search-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.date-range-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.amount-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    background: #4CAF50;
    color: white;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    margin: 2px;
}

.filter-tag .remove {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* === EMPTY STATES === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.5rem;
}

.empty-state p {
    margin: 0 0 20px 0;
    color: #666;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid #4CAF50;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
}

.toast.error { border-left-color: #f44336; }
.toast.warning { border-left-color: #ff9800; }
.toast.info { border-left-color: #2196f3; }

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
}

/* === RESPONSIVE OPTIMIZATIONS === */
@media (max-width: 768px) {
    .search-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .bulk-actions-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .date-range-picker,
    .amount-range-inputs {
        flex-direction: column;
        align-items: stretch;
    }
}

/* === PERFORMANCE OPTIMIZATIONS === */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Virtual Scrolling Container */
.virtual-scroll-container {
    height: 400px;
    overflow-y: auto;
    position: relative;
}

.virtual-scroll-spacer {
    pointer-events: none;
}

/* === PREMIUM BANKING FEATURES === */
.transaction-status-indicator {
    position: relative;
    display: inline-block;
}

.transaction-status-indicator::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
}

.transaction-status-indicator.pending::before {
    background: #ff9800;
}

.transaction-status-indicator.failed::before {
    background: #f44336;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 1; }
    70% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(0.95); opacity: 1; }
}

/* Security Indicators */
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.security-badge.high-security {
    background: #fff3e0;
    color: #f57c00;
}

/* === UNIFIED TABLE STYLES === */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.table thead {
    background: #f8f9fa;
}

.table thead th {
    padding: 16px 12px;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    text-align: left;
    font-size: 14px;
}

.table thead th.text-right {
    text-align: right;
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: top;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Transaction/Template specific styling */
.transaction-main {
    font-weight: 500;
    color: #333;
    font-size: 15px;
    margin-bottom: 4px;
}

.transaction-desc {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.3;
}

.transaction-meta {
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

/* Status badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.status-active {
    background: #e8f5e9;
    color: #4CAF50;
}

.status-inactive {
    background: #f5f5f5;
    color: #666;
}

.status-warning {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

.status-warning.overdue {
    color: #f44336;
}

.status-warning.due-soon {
    color: #ff9800;
}

.status-warning {
    background: #fff3e0;
    color: #ff9800;
}

/* Due date specific classes */
.overdue {
    background: #fef2f2;
    border-left: 4px solid #f44336;
}

.due-soon {
    background: #fff8e1;
    border-left: 4px solid #ff9800;
}

.no-due-date {
    color: #999;
}

.due-later {
    color: #666;
}

/* Amount details */
.amount-details {
    color: #666;
    font-size: 12px;
    margin-top: 2px;
    font-weight: normal;
}

/* Receipt link */
.receipt-link {
    color: #4CAF50;
    font-size: 13px;
    text-decoration: none;
}

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

/* Frequency styling */
.frequency-main {
    font-weight: 500;
    color: #333;
}

.frequency-details {
    color: #666;
    font-size: 12px;
    margin-top: 2px;
}

/* Amount styling */
.amount {
    font-weight: 600;
    font-size: 15px;
}

.amount-positive {
    color: #4CAF50;
}

.amount-negative {
    color: #f44336;
}

/* Category styling */
.category-main {
    font-weight: 500;
    color: #333;
}

.category-details {
    color: #666;
    font-size: 12px;
    margin-top: 2px;
}

/* Date styling */
.date-main {
    font-weight: 500;
    color: #333;
}

.date-main.date-overdue {
    color: #f44336;
}

.date-details {
    color: #666;
    font-size: 11px;
    margin-top: 2px;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid;
    cursor: pointer;
    font-weight: 500;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border-color: #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-success {
    background: #e8f5e9;
    color: #4CAF50;
    border-color: #4CAF50;
}

.btn-success:hover {
    background: #4CAF50;
    color: white;
}

.btn-warning {
    background: #fff3e0;
    color: #ff9800;
    border-color: #ff9800;
}

.btn-warning:hover {
    background: #ff9800;
    color: white;
}

.btn-danger {
    background: #fef2f2;
    color: #f44336;
    border-color: #f44336;
}

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

/* Row states */
.inactive-row {
    opacity: 0.6;
    background: #f8f9fa;
}

.overdue-row {
    background: #fef2f2;
    border-left: 4px solid #f44336;
}

.due-soon-row {
    background: #fff8e1;
    border-left: 4px solid #ff9800;
}

/* Utility classes */
.text-right {
    text-align: right;
}

.text-muted {
    color: #999;
    font-style: italic;
}

/* === MARKET DATA & EXCHANGE RATES === */
.market-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.market-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.market-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.crypto-icon, .currency-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.crypto-icon {
    background: linear-gradient(135deg, #f7931a, #ffb347);
    color: white;
}

.currency-icon {
    background: linear-gradient(135deg, #4CAF50, #66bb6a);
    color: white;
    font-size: 20px;
}

.market-card h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.market-subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.market-price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.market-price span {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    font-family: 'Inter', monospace;
}

.market-change {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.market-change.positive {
    background: #dcfce7;
    color: #16a34a;
}

.market-change.negative {
    background: #fef2f2;
    color: #dc2626;
}

.market-details {
    color: #6b7280;
    font-size: 13px;
}

.crypto-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f7931a, #ffb347);
}

.exchange-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #66bb6a);
}

/* Loading state for market cards */
.market-card.loading .market-price span {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    color: transparent;
    border-radius: 4px;
}

/* === PRINT STYLES === */
@media print {
    .sidebar,
    .header-modern,
    .bulk-actions-bar,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .form-container,
    .transfer-section {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
}