/* ==========================================================================
   EasyToolio Financial Tools Standard Design System
   Discount Calculator Component & Utility Styles
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
    --disc-brand-primary: #f97316;
    --disc-brand-primary-hover: #ea580c;
    --disc-brand-primary-light: rgba(249, 115, 22, 0.12);
    --disc-brand-emerald: #10b981;
    --disc-brand-emerald-light: rgba(16, 185, 129, 0.12);
    --disc-brand-indigo: #6366f1;
    --disc-brand-rose: #f43f5e;
    --disc-surface: #ffffff;
    --disc-surface-soft: #f8fafc;
    --disc-surface-card: #ffffff;
    --disc-border: #e2e8f0;
    --disc-border-strong: #cbd5e1;
    --disc-text: #0f172a;
    --disc-text-muted: #64748b;
    --disc-text-subtle: #94a3b8;
    --disc-ring: rgba(249, 115, 22, 0.35);
    --disc-slider-track: #e2e8f0;
    --disc-slider-thumb: #f97316;
    --disc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --disc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --disc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

.dark {
    --disc-surface: #09090b;
    --disc-surface-soft: #121215;
    --disc-surface-card: #18181b;
    --disc-border: rgba(255, 255, 255, 0.08);
    --disc-border-strong: rgba(255, 255, 255, 0.16);
    --disc-text: #f8fafc;
    --disc-text-muted: #a1a1aa;
    --disc-text-subtle: #71717a;
    --disc-ring: rgba(249, 115, 22, 0.45);
    --disc-slider-track: rgba(255, 255, 255, 0.12);
    --disc-slider-thumb: #f97316;
    --disc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --disc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --disc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

/* Subtle Grid Background */
.bg-subtle-grid-orange {
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(249, 115, 22, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(249, 115, 22, 0.025) 1px, transparent 1px);
}

.dark .bg-subtle-grid-orange {
    background-image:
        linear-gradient(to right, rgba(249, 115, 22, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(249, 115, 22, 0.04) 1px, transparent 1px);
}

/* Reusable Glass Cards */
.fin-glass-card {
    background: var(--disc-surface-card);
    border: 1px solid var(--disc-border);
    border-radius: 1.25rem;
    box-shadow: var(--disc-shadow-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dark .fin-glass-card {
    background: rgba(24, 24, 27, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.fin-glass-card:hover {
    border-color: var(--disc-border-strong);
}

/* Hero Result Card */
.fin-result-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(16, 185, 129, 0.05) 100%), var(--disc-surface-card);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--disc-shadow-md);
}

.dark .fin-result-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%), #121215;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Mode Switcher */
.disc-mode-switch {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    padding: 0.3rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    gap: 0.25rem;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.disc-mode-switch::-webkit-scrollbar {
    display: none;
}

.dark .disc-mode-switch {
    background: rgba(24, 24, 27, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
}

.disc-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.45rem 0.8rem;
    border: none;
    border-radius: 0.75rem;
    background: transparent;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
}

.disc-mode-btn i {
    font-size: 0.75rem;
    opacity: 0.8;
}

.disc-mode-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}

.dark .disc-mode-btn {
    color: #94a3b8;
}

.dark .disc-mode-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
}

.disc-mode-btn.is-active {
    background: #f97316;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(249, 115, 22, 0.4);
}

.disc-mode-btn.is-active i {
    opacity: 1;
    color: #ffffff;
}

/* Range Sliders */
.fin-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--disc-slider-track);
    border-radius: 9999px;
    outline: none;
    cursor: pointer;
    margin: 0.75rem 0 0.25rem 0;
    transition: background 0.2s ease;
}

.fin-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f97316;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.fin-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #ea580c;
    box-shadow: 0 0 0 4px var(--disc-ring);
}

.fin-range-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.fin-range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f97316;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.fin-range-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    background: #ea580c;
}

/* Preset Chips */
.disc-preset-chip {
    padding: 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dark .disc-preset-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.disc-preset-chip:hover {
    background: rgba(249, 115, 22, 0.12);
    color: #ea580c;
    border-color: rgba(249, 115, 22, 0.3);
}

.dark .disc-preset-chip:hover {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.4);
}

.disc-preset-chip.is-active {
    background: #f97316;
    border-color: #f97316;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(249, 115, 22, 0.35);
}

/* Type Toggle Buttons (Percentage vs Fixed) */
.disc-type-toggle {
    display: inline-flex;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.dark .disc-type-toggle {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.disc-type-btn {
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.disc-type-btn.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.dark .disc-type-btn.is-active {
    background: #27272a;
    color: #f8fafc;
}

/* Hero & Compact Values */
.disc-hero-value {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.disc-compact-value {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.disc-stat-chip {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(228, 228, 231, 0.9);
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.dark .disc-stat-chip {
    background: rgba(24, 24, 27, 0.6);
    border-color: rgba(255, 255, 255, 0.06);
}

/* Step-by-Step Price Waterfall */
.disc-waterfall-step {
    position: relative;
    padding-left: 1.25rem;
    border-left: 2px dashed #f97316;
    margin-bottom: 0.5rem;
}

.disc-waterfall-step:last-child {
    border-left-color: transparent;
    margin-bottom: 0;
}

.disc-waterfall-dot {
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f97316;
}

/* Action Buttons */
.fin-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid var(--disc-border);
    color: var(--disc-text);
    box-shadow: var(--disc-shadow-sm);
    transition: all 0.15s ease;
    cursor: pointer;
    min-height: 36px;
}

.dark .fin-action-btn {
    background: #18181b;
    border-color: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.fin-action-btn:hover {
    background: #f8fafc;
    border-color: var(--disc-border-strong);
}

.dark .fin-action-btn:hover {
    background: #27272a;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Export Popover Dropdown */
#export-dropdown {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.25), 0 10px 15px -5px rgba(0, 0, 0, 0.12) !important;
    z-index: 100 !important;
    opacity: 1 !important;
}

.dark #export-dropdown {
    background-color: #18181b !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.8) !important;
}

.fin-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.65rem;
    border-radius: 0.75rem;
    background: transparent;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.fin-dropdown-item:hover {
    background: #f1f5f9 !important;
}

.dark .fin-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Tables */
.fin-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.875rem;
    border: 1px solid var(--disc-border);
}

.fin-table {
    width: 100%;
    text-align: left;
    font-size: 0.75rem;
    border-collapse: collapse;
}

.fin-table th {
    padding: 0.65rem 0.85rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--disc-text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--disc-border);
}

.dark .fin-table th {
    background: rgba(24, 24, 27, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.fin-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--disc-border);
    color: var(--disc-text);
}

.dark .fin-table td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-slide {
    animation: fadeInSlide 0.25s ease-out forwards;
}

/* Print Specific Styles */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .fin-action-btn, #export-menu-btn, #currencySelector, #currencySelector-wrapper,
    .disc-mode-switch, .disc-preset-chip, input[type="range"], .fin-range-slider,
    header, footer, nav, .hide-print, #ask-gemini-container, .tool-related-section {
        display: none !important;
    }
    .fin-glass-card, .fin-result-card {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        break-inside: avoid;
    }
}
