/* Stiluri pentru modulul de setări */

/* Global box-sizing pentru toate elementele din settings */
.settings-grid *,
.settings-grid *::before,
.settings-grid *::after {
    box-sizing: border-box;
}

.settings-grid {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.settings-section {
    background: var(--surface-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* API Config Container */
.api-config-container {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    box-sizing: border-box;
}

/* API Keys Section */
.api-keys-section {
    background: var(--surface-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
}

/* Ascunde sectiunea Secondary API Keys — dezactivata temporar */
.api-keys-section.secondary-keys {
    display: none;
}

/* Ascunde controalele de rotatie — pastreaza doar backup-info */
.rotation-controls .form-group {
    display: none;
}

.rotation-controls .backup-info {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem; /* Gap mai mic pentru compactitate */
    flex-wrap: nowrap; /* NU permite wrap - rămân pe aceeași linie */
    min-height: 36px; /* Înălțime minimă pentru aliniere */
    cursor: pointer; /* Cursor pointer pentru a indica că este clickable */
}

.section-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1; /* Ocupă spațiul disponibil */
    min-width: 0; /* Permite micșorarea sub conținut */
    white-space: nowrap; /* Nu permite ruperea textului */
    overflow: hidden;
    text-overflow: ellipsis; /* Adaugă ... dacă e prea lung */
}

/* Collapse Toggle Button */
.collapse-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
}

.collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

.collapse-toggle svg {
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
}

.collapse-toggle svg line:first-child {
    transition: opacity 0.3s ease;
}

.collapse-toggle.collapsed svg line:first-child {
    opacity: 0;
}

/* Collapsible Content */
.collapsible-content {
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.section-header .inline-date-group {
    margin-bottom: 0;
    align-items: center;
    flex-shrink: 1; /* Permite micșorarea */
    min-width: 0; /* Permite compactare */
}

.section-header .key-expiration {
    font-size: 0.9rem;
    flex-shrink: 1; /* Permite micșorarea */
    white-space: nowrap; /* Împiedică ruperea textului */
    min-width: 0; /* Permite compactare */
    overflow: hidden;
    text-overflow: ellipsis; /* Adaugă ... dacă e prea lung */
}

/* Inline date group în header - aliniază cu h3 */
.section-header .inline-date-group label {
    line-height: 1.4;
    white-space: nowrap;
}

.section-header .inline-date-group input[type="date"] {
    margin: 0;
    font-size: 0.80rem;
}

/* Key Inputs Grid */
.key-inputs-grid {
    display: grid;
    gap: 0.75rem; /* Gap mai mic pentru aspect mai compact */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* Account Info Display - TABLE FORMAT */
.account-info-section {
    margin-top: 1rem;
    grid-column: 1 / -1; /* Ocupă toată lățimea gridului */
    overflow: visible;
}

.account-info-display {
    width: 100%;
    background: var(--background-color);
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    overflow: visible;
}

/* Tabel compact pentru informații cont */
.account-info-table {
    width: 100%;
    border-collapse: collapse;
    overflow: visible;
}

.account-info-table tr {
    border-bottom: 1px solid var(--border-color);
}

.account-info-table tr:last-child {
    border-bottom: none;
}

/* Separatoare de secțiune cu fundal distinct - Compact & Modern */
.account-info-table tr.section-divider {
    background: linear-gradient(135deg, #1a1f3a 0%, #2a3555 100%);
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.account-info-table tr.section-divider td {
    padding: 0.5rem 0.75rem;
    text-align: center;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.account-info-table td {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

.account-info-table td:first-child {
    font-weight: 500;
    color: var(--text-secondary);
    width: 180px;
    white-space: nowrap;
    font-size: 0.75rem;
}

.account-info-table td:last-child {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Hover effect pentru rânduri */
.account-info-table tr:not(.section-divider):hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Coloane alternante pentru lizibilitate */
.account-info-table tr:not(.section-divider):nth-child(even) {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Culori pentru valori reale vs generate */
.value-real {
    color: var(--settings-value-real, #059669) !important; /* Verde pentru date reale din API */
}

.value-generated {
    color: var(--settings-value-generated, #22577a) !important; /* Albastru pentru date generate */
}

/* Valori totale (consolidate) cu culoare aurie - Compact */
.value-total {
    color: var(--settings-value-total, #f39c12) !important; /* Auriu pentru valori totale */
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    text-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

.status-success {
    color: var(--success-color, #28a745);
}

/* ========== TOOLTIP INFORMATIV ========== */
.info-tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--text-secondary);
    transition: border-color 0.2s ease;
}

.info-tooltip:hover {
    border-bottom-color: var(--primary-color);
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    padding: 0.4rem 0.6rem;
    border-radius: 0.35rem;
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: normal;
    width: max-content;
    max-width: 180px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--primary-color);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 99999;
    font-weight: 400;
    text-align: left;
}

/* Săgeată tooltip */
.info-tooltip::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 4px;
    border: 5px solid transparent;
    border-right-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100000;
}

.info-tooltip:hover::after,
.info-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

.info-tooltip:hover::after {
    transform: translateY(-50%) translateX(5px);
}

.info-tooltip:hover::before {
    transform: translateY(-50%);
}

/* Animație subtilă pentru tooltip */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(5px);
    }
}

.info-tooltip:hover::after {
    animation: tooltipFadeIn 0.3s ease forwards;
}

/* Tooltip pe butoane - icon SVG în interiorul butonului */
.settings-btn .info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.95);
    border-bottom: none !important;
    margin-right: 6px;
    transition: all 0.2s ease;
}

.settings-btn .info-tooltip svg {
    display: block;
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.settings-btn .info-tooltip:hover {
    color: #ffffff;
    border-bottom: none !important;
}

.settings-btn .info-tooltip:hover svg {
    transform: scale(1.15);
    opacity: 1;
}

/* Icon vizibil când butonul este apăsat */
.settings-btn:active .info-tooltip,
.settings-btn:active .info-tooltip svg {
    opacity: 1 !important;
    visibility: visible !important;
    color: #ffffff !important;
}

/* Tooltip și săgeată vizibile când butonul este apăsat */
.settings-btn:active .info-tooltip::before,
.settings-btn:active .info-tooltip::after {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip în label-uri (API Key, API Secret) */
label .info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
    border-radius: 50%;
    border-bottom: none !important;
    margin-right: 5px;
    transition: all 0.2s ease;
    vertical-align: middle;
}

label .info-tooltip:hover {
    background: rgba(74, 144, 226, 0.2);
    color: var(--primary-color);
    transform: scale(1.1);
    border-bottom: none !important;
}

/* Tooltip-uri din butoane și label-uri - position: absolute cu părinte relativ */
.settings-btn,
.form-group label {
    position: relative;
    overflow: visible !important;
}

.settings-btn .info-tooltip,
label .info-tooltip {
    position: relative;
    display: inline-block;
}

/* Tooltip pseudo-elements pentru butoane și labels */
.settings-btn .info-tooltip::after,
label .info-tooltip::after {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    z-index: 999999;
}

.settings-btn .info-tooltip::before,
label .info-tooltip::before {
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000000;
}

.settings-btn .info-tooltip:hover::after {
    transform: translateY(-50%) translateX(5px);
    white-space: normal;
}

/* Tooltip în stânga - pentru butonul Salvează */
.tooltip-left::after {
    left: auto !important;
    right: calc(100% + 10px) !important;
}

.tooltip-left::before {
    left: auto !important;
    right: calc(100% + 4px) !important;
    border-right-color: transparent !important;
    border-left-color: #1e293b !important;
}

.tooltip-left:hover::after {
    transform: translateY(-50%) translateX(-5px) !important;
}

.tooltip-left:hover::before {
    transform: translateY(-50%) !important;
}

/* Tooltip deasupra - pentru butoanele Backup și Import */
.tooltip-top::after {
    left: 50% !important;
    top: auto !important;
    bottom: calc(100% + 10px) !important;
    transform: translateX(-50%) !important;
}

.tooltip-top::before {
    left: 50% !important;
    top: auto !important;
    bottom: calc(100% + 4px) !important;
    transform: translateX(-50%) !important;
    border-right-color: transparent !important;
    border-bottom-color: #1e293b !important;
}

.tooltip-top:hover::after {
    transform: translateX(-50%) translateY(-5px) !important;
}

.tooltip-top:hover::before {
    transform: translateX(-50%) !important;
}

/* Păstrăm vechile clase pentru compatibilitate */
.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #000;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

/* Alert Styles */
.alert {
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-danger {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 0.75rem; /* Margin mai mic pentru aspect compact */
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible; /* Permite tooltip-urilor să iasă din container */
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem; /* Spacing mai mic între label și input */
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem; /* Font mai mic pentru labels */
}

/* Inline Date Group - Label în stânga inputului */
.inline-date-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    flex-wrap: nowrap; /* Previne ruperea pe mai multe linii */
}

.inline-date-group label {
    display: inline-block;
    margin-bottom: 0; /* Elimină margin-bottom pentru aliniere inline */
    white-space: nowrap; /* Împiedică spargerea textului pe mai multe linii */
    flex-shrink: 0; /* Label nu se micșorează */
}

.inline-date-group input[type="date"] {
    width: 160px; /* Lățime fixă, suficientă pentru format dată (DD/MM/YYYY) */
    max-width: 160px;
    flex-shrink: 1; /* Permite micșorarea pe ecrane foarte mici */
    min-width: 100px; /* Lățime minimă pentru a rămâne funcțional */
    box-sizing: border-box;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 0.4rem 0.5rem; /* Padding mai mic pentru înălțime redusă */
    height: 36px; /* Înălțime fixă pentru uniformitate */
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.9rem; /* Font mai mic pentru compactitate */
    box-sizing: border-box;
}

/* Lățimi personalizate pentru API Keys - Responsive */
.form-group input#apiKey,
.form-group input#secondaryApiKey {
    width: 70%; /* 30% mai mic decât 100% */
    max-width: calc(100% - 2rem); /* Nu depășește containerul, cu margin de siguranță */
    padding-right: 2.5rem; /* Space mai mic pentru toggle button compact */
    box-sizing: border-box;
}

.form-group input#apiSecret,
.form-group input#secondaryApiSecret {
    width: min(130%, 100%); /* Maxim 100% pe ecrane mici, 130% pe ecrane mari */
    max-width: 100%; /* Nu depășește containerul pe ecrane mici */
    padding-right: 2.5rem; /* Space mai mic pentru toggle button compact */
    box-sizing: border-box;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 100%;
    width: 100%;
}

.input-group input {
    flex: 1;
    min-width: 0; /* Permite input-ului să se micșoreze sub dimensiunea content-ului */
    max-width: 100%;
    padding-right: 2.5rem; /* Space mai mic pentru toggle button compact */
    border-radius: 0.25rem; /* Keep full rounded corners */
    box-sizing: border-box;
}

.input-group .toggle-password {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 0 0.6rem; /* Padding mai mic pentru compactitate */
    border: none;
    background: transparent;
    color: #000000; /* Negru complet */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
    height: 36px; /* Aceeași înălțime cu inputul */
}

.input-group .toggle-password:hover {
    color: var(--primary-color);
}

.input-group .toggle-password svg {
    width: 18px; /* SVG mai mic pentru aspect compact */
    height: 18px;
}

.input-group .toggle-password i {
    font-size: 1rem; /* Icon mai mic */
    opacity: 1;
}

.input-group .toggle-password:hover i {
    opacity: 1;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    background: #cf5e1c !important;
    color: white !important;
    transition: background 0.2s ease;
}

.btn:hover {
    background: #b54e15 !important;
}

.btn:disabled {
    background: #999 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-primary,
.btn-secondary,
.btn-info,
.btn-success,
.btn-warning {
    background: #cf5e1c !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.25rem !important;
    font-weight: 500 !important;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-info:hover,
.btn-success:hover,
.btn-warning:hover {
    background: #b54e15 !important;
}

.btn-danger {
    background: #dc3545 !important;
    color: white !important;
}

.btn i {
    font-size: 0.9em;
}

/* ===== BUTOANE SETTINGS - Stiluri simple și curate ===== */
.settings-btn {
    background: #cf5e1c;
    color: white;
    border: none;
    padding: 0.4rem 1rem; /* Padding mai mic pentru înălțime redusă */
    height: 36px; /* Aceeași înălțime cu inputurile */
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem; /* Font mai mic pentru compactitate */
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1; /* Toate butoanele au aceeași dimensiune */
    min-width: 0; /* Permite flexbox să calculeze dimensiunea */
    max-width: 100%; /* Nu depășește containerul */
    line-height: 1; /* Controlează înălțimea textului */
    box-sizing: border-box;
    white-space: nowrap; /* Împiedică ruperea textului pe mai multe linii */
    overflow: visible; /* Permite tooltip-urilor să fie vizibile */
    text-overflow: ellipsis; /* Adaugă ... pentru text lung */
}

.settings-btn:hover {
    background: #b54e15;
}

.settings-btn:active {
    background: #9a4212;
    transform: scale(0.98);
}

.settings-btn:disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

/* API Actions Buttons - toate butoanele în linie cu aceeași dimensiune */
.api-actions-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: stretch; /* Stretch pentru înălțime uniformă */
    margin-top: 0;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap; /* Butoanele rămân pe aceeași linie */
    grid-column: 1 / -1; /* Ocupă toată lățimea gridului, ca și account-info-section */
    overflow: visible; /* Permite tooltip-urilor să iasă */
}

.api-actions-buttons .settings-btn {
    flex: 1; /* Fiecare buton ocupă spațiu egal */
    min-width: 0; /* Permite comprimarea */
    white-space: nowrap; /* Textul nu se împarte pe rânduri */
    overflow: visible; /* Permite tooltip-urilor să fie vizibile */
    text-overflow: ellipsis; /* Adaugă ... pentru text lung */
}

/* Elimină clasa settings-btn-save - toate butoanele sunt uniforme */

/* ===== RESPONSIVE DESIGN - Media Queries ===== */

/* Tablete și ecrane mici (sub 1024px) */
@media (max-width: 1024px) {
    .settings-form {
        grid-template-columns: 1fr;
    }
    
    .api-keys-section {
        padding: 1.25rem;
    }
    
    .form-group input#apiKey,
    .form-group input#secondaryApiKey {
        width: 100%; /* Full width pe ecrane mici */
        max-width: 100%;
    }
    
    .form-group input#apiSecret,
    .form-group input#secondaryApiSecret {
        width: 100%; /* Full width pe ecrane mici */
        max-width: 100%;
    }
    
    .account-info-display {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    /* Section header rămâne pe aceeași linie, dar mai compact */
    .section-header {
        gap: 0.5rem;
    }
    
    .section-header h3 {
        font-size: 1rem; /* Font mai mic */
        flex: 1;
        min-width: 0;
    }
    
    .section-header .inline-date-group {
        flex-shrink: 1;
    }
    
    .section-header .inline-date-group label {
        font-size: 0.85rem; /* Label mai mic */
    }
    
    .section-header .key-expiration {
        font-size: 0.8rem; /* Font mai mic */
    }
    
    /* Inline date group mai mic pe tablete */
    .inline-date-group input[type="date"] {
        width: 120px; /* Mai mic pe tablete */
        max-width: 120px;
        font-size: 0.85rem;
    }
    
    /* Butoane responsive pe tablete - rămân pe aceeași linie */
    .api-actions-buttons {
        flex-wrap: nowrap;
        gap: 0.4rem; /* Gap mai mic pentru tablete */
    }
    
    .settings-btn {
        min-width: 0;
        flex: 1 1 auto;
        font-size: 0.85rem; /* Font mai mic pentru a încăpea pe aceeași linie */
        padding: 0 0.6rem; /* Padding mai mic */
    }
}

/* Telefoane și ecrane foarte mici (sub 768px) */
@media (max-width: 768px) {
    .settings-form {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .settings-section,
    .api-keys-section {
        padding: 1rem;
    }
    
    /* Section header rămâne pe o singură linie, dar mai compact */
    .section-header {
        gap: 0.4rem;
    }
    
    .section-header h3 {
        font-size: 0.9rem; /* Font mai mic pe telefoane */
        min-width: 0;
        flex: 1;
    }
    
    .section-header .inline-date-group {
        flex-shrink: 1;
    }
    
    .section-header .inline-date-group label {
        font-size: 0.75rem; /* Label foarte mic pe telefoane */
    }
    
    .section-header .key-expiration {
        font-size: 0.75rem; /* Font foarte mic pe telefoane */
    }
    
    /* Inline date group - input mai mic */
    .inline-date-group {
        gap: 0.3rem;
    }
    
    .inline-date-group input[type="date"] {
        width: 100px; /* Mult mai mic pe telefoane */
        max-width: 100px;
        font-size: 0.75rem;
        padding: 0.3rem 0.4rem;
    }
    
    /* Butoanele rămân pe aceeași linie pentru telefoane */
    .api-actions-buttons {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.3rem; /* Gap mai mic pentru telefoane */
        width: 100%;
        max-width: 100%;
    }
    
    .api-actions-buttons .settings-btn {
        padding: 0 0.4rem;
        height: 34px; /* Puțin mai mic pe tablete */
        font-size: 0.7rem; /* Font foarte mic pentru a încăpea */
        min-width: 0;
        flex: 1;
    }
    
    .settings-btn {
        padding: 0.4rem 0.6rem;
        height: 34px;
        font-size: 0.85rem;
        width: 100%;
        max-width: 100%;
    }
    
    .form-group input#apiKey,
    .form-group input#secondaryApiKey,
    .form-group input#apiSecret,
    .form-group input#secondaryApiSecret {
        width: 100%;
        max-width: 100%;
        font-size: 0.9rem;
    }
    
    .account-info-display {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .info-item {
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .info-item:last-child {
        border-bottom: none;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Telefoane foarte mici (sub 480px) */
@media (max-width: 480px) {
    .settings-grid {
        padding: 0.5rem;
    }
    
    .settings-section,
    .api-keys-section {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    /* Section header ultra-compact, dar rămâne pe o linie */
    .section-header {
        gap: 0.25rem;
    }
    
    .section-header h3 {
        font-size: 0.8rem; /* Font foarte mic */
        min-width: 0;
        flex: 1;
    }
    
    .section-header .inline-date-group label {
        font-size: 0.7rem; /* Label extrem de mic */
    }
    
    .section-header .key-expiration {
        font-size: 0.7rem; /* Font extrem de mic */
    }
    
    .inline-date-group {
        gap: 0.25rem;
    }
    
    .inline-date-group input[type="date"] {
        width: 85px; /* Foarte mic pe telefoane mici */
        max-width: 85px;
        font-size: 0.7rem;
        padding: 0.25rem 0.3rem;
        height: 28px;
    }
    
    /* Badge mai mic */
    .badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
    }
    
    /* Butoanele rămân pe aceeași linie chiar și pe telefoane foarte mici */
    .api-actions-buttons {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.25rem; /* Gap minimal */
        width: 100%;
        max-width: 100%;
    }
    
    .api-actions-buttons .settings-btn {
        padding: 0 0.3rem;
        height: 32px;
        font-size: 0.65rem; /* Font ultra-mic pentru telefoane mici */
        min-width: 0;
        flex: 1;
    }
    
    .settings-btn {
        padding: 0.4rem 0.6rem;
        height: 32px; /* Puțin mai mic pe telefoane */
        font-size: 0.85rem;
        width: 100%;
        max-width: 100%;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }
    
    .form-group input,
    .form-group select {
        font-size: 0.85rem;
        padding: 0.35rem 0.4rem;
        height: 32px; /* Aceeași înălțime cu butoanele */
        width: 100%;
        max-width: 100%;
    }
    
    /* Inline date group pe telefoane mici */
    .inline-date-group {
        gap: 0.4rem;
        flex-wrap: wrap; /* Permite wrap dacă e necesar */
        max-width: 100%;
    }
    
    .inline-date-group label {
        font-size: 0.8rem;
    }
    
    .inline-date-group input[type="date"] {
        width: 120px; /* Mai mic pe telefoane mici */
        max-width: calc(100% - 80px); /* Lasă spațiu pentru label */
        font-size: 0.8rem;
        height: 32px;
    }
    
    /* Toggle password button mai mic */
    .input-group .toggle-password {
        padding: 0 0.4rem;
        height: 32px; /* Aceeași înălțime cu inputul */
    }
    
    .input-group .toggle-password svg {
        width: 14px;
        height: 14px;
    }
    
    .account-info-display {
        padding: 0.75rem;
    }
    
    .info-label {
        font-size: 0.75rem;
    }
    
    .info-value {
        font-size: 0.85rem;
    }
    
    .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .key-expiration {
        font-size: 0.8rem;
    }
    
    .section-header {
        gap: 0.75rem;
    }
}
/* ============================================================================
    TRADING FEES SECTION
   ============================================================================ */

/* ============================================================================
   💰 TRADING FEES SECTION (Styled identic cu API Config)
   ============================================================================ */

.trading-fees-section {
    background: var(--surface-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
}

.trading-fees-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
    flex-wrap: nowrap;
    min-height: 36px;
    cursor: default; /* Nu e collapsible, deci cursor normal */
}

/* ✅ FIX (13 Apr 2026): Header restructurat pe 2 randuri
   Randul 1: titlu + butoane (stanga-dreapta)
   Randul 2: linkuri surse date (sub titlu) */
.trading-fees-section .trading-fees-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
}

.trading-fees-section .trading-fees-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.trading-fees-section .trading-fees-header .section-header-meta {
    margin-left: 0.1rem;
}

.trading-fees-section h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bloc sursa date — sub titlu, inline in section-header */
.trading-fees-section .section-header-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.trading-fees-section .fees-source-label {
    opacity: 0.7;
}

.trading-fees-section .fees-source-link {
    color: var(--accent-color, #3b82f6);
    text-decoration: none;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    border-bottom: 1px dashed currentColor;
    transition: opacity 0.2s;
}

.trading-fees-section .fees-source-link:hover {
    opacity: 0.75;
    border-bottom-style: solid;
}

.trading-fees-section .fees-source-link--futures {
    color: var(--accent-purple, #8b5cf6);
}

.trading-fees-section .fees-source-sep {
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 0.7rem;
}

/* ✅ Market Filter Toggle Buttons */
.market-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 0.5rem;
}

.filter-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: rgba(var(--primary-rgb, 76, 175, 80), 0.1);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.fees-table-container {
    overflow-x: auto;
    max-height: 450px; /* ✅ Max înălțime pentru ~10 rânduri */
    overflow-y: auto; /* ✅ Scroll vertical */
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.fees-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color); /* ✅ Folosește surface-color (light/dark compatible) */
    border-radius: 4px;
    font-size: 0.9rem; /* ✅ Text mai mic pentru compactitate */
}

.fees-table thead {
    background: var(--background-secondary); /* ✅ Adaptiv: #f1f5f9 (light) / #1e293b (dark) */
    position: sticky; /* ✅ Header rămâne vizibil la scroll */
    top: 0;
    z-index: 10;
}

.fees-table th {
    padding: 8px 10px; /* ✅ Padding redus */
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem; /* ✅ Font mai mic */
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

/* ✅ Sortable column header */
.fees-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    background: var(--background-secondary); /* ✅ Explicit background pentru light/dark mode */
}

.fees-table th.sortable:hover {
    background: rgba(var(--primary-rgb, 76, 175, 80), 0.1); /* Verde temporar la hover */
    color: var(--text-primary);
}

/* ✅ Asigurăm că background revine la culoarea header-ului după hover */
.fees-table th.sortable:not(:hover) {
    background: var(--background-secondary); /* Light: #f1f5f9, Dark: #1e293b */
}

/* ✅ Eliminat :active pentru a păstra culoarea inițială după click */

.fees-table th.sortable .sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.8em;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.fees-table th.sortable:hover .sort-icon {
    color: var(--primary-color);
}

.fees-table td {
    padding: 6px 10px; /* ✅ Padding redus */
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem; /* ✅ Font mai mic */
}

.fee-row {
    transition: background 0.2s;
}

.fee-row:hover {
    background: rgba(var(--primary-rgb, 76, 175, 80), 0.1); /* ✅ Hover subtil */
}

.fee-row.expired {
    opacity: 0.7;
}

.fee-row.expired td {
    color: var(--warning-color, #ff9800);
}

.source-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

/* ✅ Source badge colors */
.source-badge.source-api {
    background: rgba(76, 175, 80, 0.2); /* Verde */
    color: var(--success-color);
}

.source-badge.source-cache {
    background: rgba(59, 130, 246, 0.2); /* Albastru */
    color: var(--primary-color);
}

.source-badge.source-cache-expired {
    background: rgba(255, 152, 0, 0.2); /* Orange */
    color: var(--warning-color);
}

.source-badge.source-default {
    background: rgba(128, 128, 128, 0.2); /* Gri */
    color: var(--text-secondary);
}

/* ✅ Market badge colors */
.market-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
}

.market-badge.market-spot {
    background: rgba(59, 130, 246, 0.2); /* Albastru */
    color: var(--primary-color);
}

.market-badge.market-futures {
    background: rgba(168, 85, 247, 0.2); /* Violet */
    color: #a855f7;
}

/* ✅ Icon-uri pentru Cache Status */
.fee-row.valid td:nth-child(6) {
    color: var(--success-color); /* Verde pentru ✓ */
    font-weight: 600;
}

.fee-row.expired td:nth-child(6) {
    color: var(--warning-color); /* Orange pentru ✗ */
    font-weight: 600;
}

.empty-state,
.loading,
.error {
    /*padding: 40px;*/
    text-align: center;
    color: var(--text-secondary, #aaaaaa);
    font-size: 1.1em;
}

.error {
    color: var(--danger-color, #f44336);
}

.loading {
    color: var(--primary-color, #4CAF50);
}

/* ✅ Scrollbar personalizat pentru fees-table-container */
.fees-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.fees-table-container::-webkit-scrollbar-track {
    background: var(--background-secondary);
    border-radius: 4px;
}

.fees-table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.fees-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 768px) {
    .trading-fees-section .section-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .fees-table {
        font-size: 0.9em;
    }
    
    
    .fees-table th,
    .fees-table td {
        padding: 8px;
    }
}

/* ========================================
   ✅ ADD/DELETE SYMBOLS - MODAL & BUTTONS
   ======================================== */

/* Section actions (buttons în header) */
.section-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-success:hover {
    background: #16a34a;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 1.5rem;
    min-height: 400px; /* ✅ FIX: Înălțime minimă pentru a vedea lista autocomplete */
    position: relative; /* ✅ Pentru poziționarea corectă a autocomplete-ului */
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Form groups */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: rgb(254, 255, 251);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background-primary);
    /*color: rgb(254, 255, 251);*/
    color: var(--text-primary); /* ✅ FIX: Culoare dinamică pentru text */
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group .hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Radio group */
.radio-group {
    display: flex;
    gap: 3.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.radio-group input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Autocomplete */
.autocomplete-results {
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.25rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 0.20rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s, color 0.2s;
    color: var(--text-primary); /* ✅ FIX: Culoare dinamică pentru text */
    background: var(--surface-color);
}

.autocomplete-item:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-no-results {
    padding: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    background: var(--surface-color);
}

/* Error message */
.error-message {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: 4px;
    color: var(--error-color);
    margin-top: 1rem;
}

/* Delete button */
.btn-delete-fee {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
    color: var(--text-secondary); /* ✅ Culoare dinamică pentru SVG */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-fee:hover {
    transform: scale(1.15);
    color: var(--error-color); /* ✅ Roșu la hover */
}

.btn-delete-fee svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s ease;
}

/* Secondary button */
.btn-secondary {
    background: var(--background-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--background-tertiary);
}

/* ✅ Autocomplete loading state */
.autocomplete-loading {
    padding: 0.75rem;
    color: var(--text-secondary);
    background: var(--surface-color);
    text-align: center;
    font-style: italic;
}

/* ✅ Autocomplete error state */
.autocomplete-error {
    padding: 0.75rem;
    color: var(--error-color);
    background: var(--surface-color);
    text-align: center;
    border: 1px solid var(--error-color);
    border-radius: 4px;
    margin: 0.5rem;
}

.autocomplete-error small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

