/* Base Reset & Variables */
:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --success-color: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    /* Safe Area Support */
    overflow-x: hidden;
}

/* --- MOBILE OPTIMIZATIONS (Touch Targets & Scrollbars) --- */
@media (max-width: 768px) {

    /* Touch Targets 44x44px min */
    /* Touch Targets 44x44px min */
    input,
    select,
    button,
    .tab-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Scrollbar Hidden on Mobile */
    * {
        scrollbar-width: none !important;
        /* Firefox */
    }

    *::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    /* Better Input Padding */
    .range-manual-input {
        padding-right: 2.5rem !important;
        /* Adjust for smaller screens */
    }
}

/* Background Effects */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.4;
    animation: flow 20s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #4f46e5;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #db2777;
    animation-delay: -10s;
}

@keyframes flow {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, -30px) scale(1.1);
    }
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 10;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Tabs */
.nav-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 10;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.tab-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.tab-btn:hover:not(.active) {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

/* Sub-Navigation (Integrated with cards) */
/* Sub-Navigation (Integrated with cards) */
/* Sub-Navigation (Integrated with cards) */
.sub-nav-container {
    display: flex;
    gap: 0;
    /* Attached buttons */
    margin-bottom: -1px;
    /* Overlap with the glass-panel border */
    padding-left: 0;
    /* Align left with the window */
    position: relative;
    z-index: 1;
    /* LOWER this to sit behind the card by default */
}

.sub-tab-btn {
    background: rgba(15, 23, 42, 0.6);
    /* Slightly darker for inactive */
    border: 1px solid var(--glass-border);
    border-bottom: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    margin-right: -1px;
    /* Fuse borders */
    position: relative;
    top: 4px;
    /* Push down slightly so active one pops up */
    display: flex;
    justify-content: center;
    align-items: center;
}

.sub-tab-btn.active {
    background: rgba(255, 255, 255, 0.05);
    /* Same as glass-panel */
    color: white;
    border-bottom: 1px solid transparent;
    /* Remove bottom border to merge */
    padding: 0.8rem 2rem;
    /* Bigger padding */
    font-size: 1rem;
    /* Bigger font */
    font-weight: 600;
    top: 0;
    /* Pop up */
    z-index: 6;
    /* HIGHER than the card (5) */
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

.sub-tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 1400px;
}

.tab-content.active {
    display: block;
    /* Grid is handled by internal classes */
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grid Layout (Restoring the side-by-side look) */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    width: 100%;
    align-items: start;
}

@media (min-width: 1024px) {
    .grid-layout {
        grid-template-columns: 400px 1fr;
    }
}

/* optimizer layout centered */
.optimizer-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

/* Input Section Specifics */
.input-section {
    position: sticky;
    top: 1rem;
    padding-top: 1rem;
    /* Ensure space for tabs if sticky */
}

/* Fix for integrated tabs: Remove top-left radius where tabs sit */
.input-section .glass-panel {
    border-top-left-radius: 0;
    position: relative;
    z-index: 5;
    /* Sit above inactive tabs (1) but below active tab (6) */
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Inputs */
.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* FIX: Hide native spin buttons to prevent text truncation */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
    /* Firefox */
}

/* Inputs */
input,
select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-height: 44px;
    /* Ensure accessible touch target size */
}

input:focus,
select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    outline: none;
    background: rgba(15, 23, 42, 0.8);
}

/* Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 44px;
    /* Maintain touch size */
    background: transparent !important;
    /* FIX: Remove solid box */
    border: none;
    margin: 0;
    padding: 0;
}

/* Track Styling */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #334155;
    border-radius: 3px;
    cursor: pointer;
}

/* Thumb Styling */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.2s;
    border: 2px solid white;
    margin-top: -7px;
    /* Center thumb: (6px track / 2) - (20px thumb / 2) = -7px */
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Manual Input Styling (Side-by-side) */
.range-manual-input {
    width: 100%;
    height: 36px !important;
    /* Slightly smaller than main inputs */
    min-height: 36px !important;
    padding: 0.2rem 0.5rem !important;
    text-align: right;
    padding-right: 3.5rem !important;
    /* FIX: Increased padding to 3.5rem for clear separation from label */
    background: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    /* FIX: Ensure text isn't too large */
}

.range-manual-input:focus {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--accent-color) !important;
}

.unit-label {
    margin-top: 0;
    /* Reset margin */
}

.range-value {
    display: none;
    /* Hide old values if any remain */
}

/* Toggle Switch */
.toggle-interaction {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: 12px;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
    /* background-color and border-radius moved to .slider */
    flex-shrink: 0;
}

/* .switch::after removed to prevent double knob */

input[type="checkbox"] {
    display: none;
}

input[type="checkbox"]:checked+.slider {
    background-color: var(--accent-color);
}

input[type="checkbox"]:checked+.slider::after {
    transform: translateX(20px);
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider::after {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-label {
    font-size: 0.95rem;
    color: var(--text-primary);
}


/* Button */
.primary-btn {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--accent-color), #4f46e5);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px var(--accent-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(99, 102, 241, 0.6);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Results Content */
h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    font-weight: 700;
    color: white;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Comparison Grid Styles */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .span-two-cols {
        grid-column: span 2;
    }
}

.scenario-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.scenario-column h4 {
    text-align: center;
    color: var(--accent-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Inner Cards */
.card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    container-type: inline-size;
    /* Enable container queries */
}

.big-number {
    /* 10cqi = 10% of card width. Lower min size to 0.7rem to fit 9B+ */
    font-size: clamp(0.7rem, 11cqi, 2.5rem);
    font-weight: 800;
    color: var(--accent-color);
    margin-top: 0.5rem;
    white-space: nowrap;
    /* Prevent wrapping */
    overflow: hidden;
    /* Safety clip */
    text-overflow: clip;
    line-height: 1.2;
}

.medium-number {
    font-size: clamp(0.6rem, 8cqi, 1.75rem);
    font-weight: 700;
    color: white;
    margin-top: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.2;
}

/* Charts */
.chart-container {
    height: 350px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    position: relative;
}

.hidden {
    display: none !important;
}

small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Stile per i pulsanti interni all'Optimizer (copia dello stile tab-btn) */
.opt-switch-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.opt-switch-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.opt-switch-btn:hover:not(.active) {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

/* Income Type Switch Buttons */
.type-switch-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.type-switch-btn.active {
    background: var(--accent-color);
    color: white;
}

.type-switch-btn:hover:not(.active) {
    color: white;
}

/* --- STILE PIANO DI AMMORTAMENTO --- */
.amortization-table {
    width: 100%;
    border-collapse: collapse;
    color: #cbd5e1;
    font-size: 0.95rem;
    min-width: 500px;
    /* Evita che si schiacci su mobile */
    white-space: nowrap;
}

/* Removed empty ruleset based on lint feedback */

.amortization-table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent-color);
    font-weight: 600;
}

.amortization-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.amortization-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Navigazione Tabella Ammortamento */
.nav-arrow-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.nav-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

.nav-arrow-btn.hidden {
    display: none !important;
}

/* --- INVESTMENT PRESETS & SAVINGS UI --- */
.investment-presets {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.preset-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.preset-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.savings-text-container {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.savings-text {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-bottom: 0 !important;
    text-align: center;
}

.savings-text strong {
    color: #10b981;
    font-size: 1.1rem;
}


/* --- DESKTOP LAYOUT (min-width: 1024px) --- */
@media (min-width: 1024px) {

    /* 0. Remove App-Lock, Enable Scrolling */
    body {
        height: auto;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        padding-bottom: 2rem;
    }

    /* 1. Structural Refactoring: Natural Flow */
    .tab-content.active {
        display: block;
        /* Flow naturally */
        height: auto;
        overflow: visible;
        /* Show all content */
        padding-bottom: 2rem;
    }

    /* FIX: Sub-tab content visible */
    .sub-tab-content {
        height: auto;
        width: 100%;
        display: block;
    }

    /* 2. Grid Layout */
    .grid-layout {
        height: auto;
        align-items: start;
        /* Standard alignment */
        gap: 2rem;
        grid-template-columns: 400px 1fr;
        /* Maintain 2 columns */
        overflow: visible;
    }

    /* 3. Optimizer Layout Natural Flow */
    .optimizer-layout {
        height: auto;
        width: 100%;
        overflow: visible;
        padding: 0 1rem 4rem 1rem;
        display: block;
    }

    .optimizer-layout::-webkit-scrollbar {
        display: none;
    }

    /* Panel Width Fix */
    .optimizer-layout .glass-panel {
        max-width: 900px;
        width: 100%;
        margin: 1rem auto 0 auto;
    }

    /* 4. Restore Sticky Inputs */
    .input-section {
        position: sticky;
        top: 2rem;
        height: auto;
        overflow: visible;
        padding-top: 1rem;
    }

    .results-section {
        height: auto;
        overflow: visible;
    }

    /* Remove previous scrollbar hacks */
    .input-section::-webkit-scrollbar,
    .results-section::-webkit-scrollbar {
        display: none;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-layout {
        grid-template-columns: 1fr;
        max-width: 600px;
        margin: 0 auto;
    }

    .input-section {
        position: static;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
        /* Reduced horizontal padding for more space */
        overflow-x: hidden;
    }

    h1 {
        font-size: 1.8rem;
        word-wrap: break-word;
        /* Prevent overflow on long titles */
    }

    h2 {
        font-size: 1.4rem;
    }

    .glass-panel {
        padding: 1.25rem;
        backdrop-filter: blur(10px);
        /* Reduced blur for performance */
        -webkit-backdrop-filter: blur(10px);
        width: 100%;
        border-radius: 20px;
    }

    /* Stacking Layout */
    .grid-layout {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Tabs Navigation */
    .nav-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .tab-btn {
        flex-shrink: 0;
        min-height: 44px;
        /* Touch target */
        padding: 0.75rem 1.2rem;
    }

    /* Inputs & Touch Targets */
    .input-group {
        margin-bottom: 1.2rem;
    }

    .input-group input,
    .input-group select,
    .primary-btn,
    .preset-btn,
    .opt-switch-btn {
        min-height: 44px;
        /* Apple minimum touch target */
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .input-group input[type="number"],
    .input-group input[type="text"] {
        padding: 0.8rem;
        /* Comfortable padding */
    }

    /* Range Input - Larger Touch Area */
    input[type="range"] {
        margin-top: 1.2rem;
        margin-bottom: 0.8rem;
        height: 8px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        /* Larger thumb */
        height: 28px;
    }

    /* Toggle Switches - Ensure separate clickable areas */
    .toggle-interaction {
        padding: 0.8rem;
        margin-bottom: 1rem;
        /* Ensure gap between elements */
    }

    /* Sub-tabs adjustments */
    .sub-nav-container {
        margin-bottom: 0;
    }

    .sub-tab-btn {
        min-height: 44px;
        padding: 0.6rem 1.2rem;
        flex: 1;
        /* Distribute space */
    }

    /* Cards Stacking */
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .scenario-column {
        padding: 1rem;
    }

    /* Charts */
    .chart-container {
        height: 280px;
        /* Adjust for small screens */
        padding: 0.5rem;
    }

    /* Table Mobile Optimization */
    .amortization-table {
        min-width: 600px;
        /* Force internal scroll */
    }

    #amortizationTableContainer,
    #amortizationTableContainer_fin {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
    }

    /* Nav Arrows larger for touch */
    .nav-arrow-btn {
        width: 44px;
        height: 44px;
    }

    .table-nav-header h3 {
        font-size: 1.1rem;
    }

    /* Scroll Hint */
    .scroll-hint {
        display: block;
        text-align: center;
        color: var(--text-secondary);
        margin-bottom: 0.5rem;
        font-style: italic;
        font-size: 0.9rem;
    }
}

@media (min-width: 769px) {
    .scroll-hint {
        display: none;
    }
}

/* REMOVED VISIBLE SCROLLBAR STYLES */


/* FIX: Prevent shrinking of children inside scrollable areas */
.input-section>*,
.results-section>* {
    flex-shrink: 0;
}

/* Container per distanziare il bottone */
.transfer-action-container {
    margin-top: 2rem;
    text-align: center;
    width: 100%;
}

/* Stile Base Bottone (Desktop Default) */
.transfer-btn {
    background: transparent !important;
    border: 1px solid var(--text-secondary) !important;
    color: var(--text-secondary) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: auto !important;
    /* Desktop: larghezza contenuto */
    padding: 0.8rem 2rem !important;
    transition: all 0.2s ease;
}

.transfer-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: white !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 768px) {
    .transfer-btn {
        width: 100% !important;
        /* Mobile: Full width per tocco facile */
        min-height: 50px;
        /* Touch target aumentato */
        margin-bottom: 1rem;
        /* Spazio extra dal bordo inferiore */
    }

    .transfer-action-container {
        padding: 0 1rem;
        /* Margine di sicurezza laterale */
    }
}

/* Utility Class for Screen Readers (SEO Hidden) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* FAQ Section Styles */
.faq-section {
    width: 100%;
    max-width: 900px;
    margin: 4rem auto 2rem auto;
    padding: 0 1rem;
}

.faq-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.faq-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--accent-color);
}

.faq-item[open] {
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

summary {
    padding: 1.2rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    position: relative;
    padding-right: 3rem;
    color: white;
    font-size: 1.05rem;
}

/* Custom Marker animato */
summary::after {
    content: '+';
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--accent-color);
    transition: transform 0.3s;
    font-weight: 300;
}

details[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

.faq-answer {
    padding: 0 1.2rem 1.5rem 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    animation: fadeIn 0.3s ease;
}

.faq-answer strong {
    color: #e2e8f0;
}

/* Nasconde marker default su Safari/Chrome */
summary::-webkit-details-marker {
    display: none;
}

/* --- CUSTOM SELECT DROPDOWN (Glassmorphism) --- */
select {
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(15, 23, 42, 0.6);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    /* Space for arrow */
    color: white;
}

/* Fix for options (Windows/Desktop) */
select option {
    background-color: #0f172a;
    /* Dark background */
    color: white;
}