/* Codice Fiscale Generator Styles */

#codice-fiscale-container { min-height: 80vh; }

#codice-fiscale-container h1 { color: #fff; font-weight: 700; }
#codice-fiscale-container .lead { color: rgba(255, 255, 255, 0.7); }

.cf-output-section,
.cf-form-section,
.cf-tabs-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
}

.cf-output-section h5,
.cf-form-section h5 { color: #fff; font-weight: 600; margin: 0; }

/* Equal-height columns on desktop */
@media (min-width: 992px) {
    .cf-main-row { align-items: stretch; }
    .cf-output-section { position: sticky; top: 90px; }
}

/* Inline details inside the output card */
.cf-inline-details {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cf-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px 14px;
}
.cf-detail-row .detail-label {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}
.cf-detail-row .detail-value {
    color: #55ddff;
    font-family: 'Courier New', monospace;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 2px;
}

/* Action buttons */
.btn-action {
    background: rgba(85, 221, 255, 0.1);
    border: 1px solid rgba(85, 221, 255, 0.3);
    color: #55ddff;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.btn-action:hover {
    background: rgba(85, 221, 255, 0.2);
    border-color: #55ddff;
    color: #55ddff;
    transform: translateY(-1px);
}
.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary-action {
    background: rgba(85, 221, 255, 0.25);
}

/* Main CF Input */
#main-cf-input {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(85, 221, 255, 0.3);
    color: #55ddff;
    font-family: 'Courier New', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 3px;
    padding: 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    text-transform: uppercase;
}
#main-cf-input:focus { outline: none; border-color: #55ddff; box-shadow: 0 0 20px rgba(85, 221, 255, 0.2); }
#main-cf-input::placeholder { color: rgba(85, 221, 255, 0.4); font-size: 1rem; letter-spacing: normal; font-weight: 400; }
#main-cf-input.copy-success { border-color: #4ade80; box-shadow: 0 0 20px rgba(74, 222, 128, 0.3); }
#main-cf-input.cf-complete { border-color: #4ade80; color: #4ade80; }

/* Radio group sesso */
.cf-radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.cf-radio {
    flex: 1 1 0;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    user-select: none;
    margin: 0;
}
.cf-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cf-radio:hover {
    border-color: rgba(85, 221, 255, 0.4);
    color: #fff;
}
.cf-radio:has(input:checked) {
    background: rgba(85, 221, 255, 0.15);
    border-color: #55ddff;
    color: #55ddff;
    box-shadow: 0 0 0 0.15rem rgba(85, 221, 255, 0.2);
}
.cf-radio:has(input:focus-visible) {
    outline: 2px solid #55ddff;
    outline-offset: 2px;
}

/* Belfiore toggle link */
.cf-belfiore-toggle { font-size: 0.85rem; }
.cf-link {
    color: #55ddff;
    text-decoration: none;
    border-bottom: 1px dashed rgba(85, 221, 255, 0.5);
    transition: all 0.2s ease;
}
.cf-link:hover { color: #fff; border-bottom-color: #fff; }
#cf-belfiore-wrap .form-label { color: rgba(255, 255, 255, 0.65); }

/* Status text — readable on dark bg */
#cf-status {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 500;
    min-height: 1.4rem;
}
#cf-status.text-success { color: #4ade80 !important; }
#cf-status.text-danger { color: #f87171 !important; }
#cf-status.cf-status-info { color: #fcd34d !important; } /* amber info */

/* Mode toggle button */
.cf-mode-toggle {
    background: rgba(85, 221, 255, 0.15);
    border-color: rgba(85, 221, 255, 0.4);
    font-weight: 500;
}

/* Warning banner */
.cf-warning-banner {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 10px;
    padding: 12px 16px;
    color: #fcd34d;
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.5;
}
.cf-warning-banner i { color: #fbbf24; flex-shrink: 0; margin-top: 3px; }
.cf-warning-banner strong { color: #fde68a; }

/* Swap columns in reverse mode (desktop only) */
@media (min-width: 992px) {
    .cf-main-row.cf-reverse-mode > .col-lg-6:first-child { order: 2; }
    .cf-main-row.cf-reverse-mode > .col-lg-6:last-child  { order: 1; }
}

/* When reverse mode: CF input is editable, looks active */
.cf-main-row.cf-reverse-mode #main-cf-input {
    color: #fff;
    cursor: text;
    border-color: #55ddff;
    background: rgba(0, 0, 0, 0.45);
}
.cf-main-row.cf-reverse-mode #main-cf-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
    letter-spacing: normal;
    font-size: 1rem;
}

/* Readonly state for form fields in reverse mode */
.cf-main-row.cf-reverse-mode .cf-form-section .form-control[readonly],
.cf-main-row.cf-reverse-mode .cf-form-section .form-control:disabled {
    background: rgba(0, 0, 0, 0.2);
    color: #55ddff;
    cursor: default;
}
.cf-main-row.cf-reverse-mode .cf-radio { opacity: 0.85; cursor: default; }
.cf-main-row.cf-reverse-mode .cf-radio:hover { border-color: rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.7); }
.cf-main-row.cf-reverse-mode .cf-radio:has(input:checked) { opacity: 1; }
.cf-main-row.cf-reverse-mode #btn-reset-cf {
    /* still allow reset of CF input */
}

/* Candidates chips */
.cf-candidates {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.cf-candidates-group + .cf-candidates-group { margin-top: 10px; }
.cf-candidates-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.cf-candidates-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-chip {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cf-chip:hover { border-color: rgba(85, 221, 255, 0.5); color: #fff; }
.cf-chip-primary {
    background: rgba(85, 221, 255, 0.18);
    border-color: #55ddff;
    color: #55ddff;
    font-weight: 600;
}
.cf-no-cand { color: rgba(255, 255, 255, 0.5); font-size: 0.85rem; font-style: italic; }

/* "More" ellipsis chip */
.cf-chip-more {
    background: rgba(85, 221, 255, 0.08);
    border-color: rgba(85, 221, 255, 0.35);
    color: #55ddff;
    font-weight: 600;
}
.cf-chip-more:hover {
    background: rgba(85, 221, 255, 0.2);
    border-color: #55ddff;
}
.cf-chip-more i { margin-right: 4px; }

/* ===== Modal ===== */
.cf-modal {
    position: fixed; inset: 0;
    z-index: 1050;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.cf-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    animation: cfModalFade 0.18s ease;
}
.cf-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    border: 1px solid rgba(85, 221, 255, 0.3);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    animation: cfModalIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes cfModalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cfModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cf-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.cf-modal-title { color: #fff; font-size: 1rem; font-weight: 600; margin: 0; }
.cf-modal-close {
    background: transparent; border: none; color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.cf-modal-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.cf-modal-search {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}
.cf-modal-search i { color: rgba(255, 255, 255, 0.5); }
.cf-modal-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    padding: 4px 0;
}
.cf-modal-search input::placeholder { color: rgba(255, 255, 255, 0.4); }
.cf-modal-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

.cf-modal-body {
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}
.cf-modal-body::-webkit-scrollbar { width: 8px; }
.cf-modal-body::-webkit-scrollbar-thumb { background: rgba(85, 221, 255, 0.3); border-radius: 4px; }
.cf-modal-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.12s ease;
}
.cf-modal-item:hover {
    background: rgba(85, 221, 255, 0.15);
    border-color: #55ddff;
    color: #55ddff;
    transform: translateY(-1px);
}
.cf-modal-empty {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    padding: 24px;
}

/* Form */
.cf-form-section .form-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}
.cf-form-section .form-control,
.cf-form-section .form-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 8px;
}
.cf-form-section .form-control:focus,
.cf-form-section .form-select:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: #55ddff;
    box-shadow: 0 0 0 0.15rem rgba(85, 221, 255, 0.25);
    color: #fff;
}
.cf-form-section .form-control::placeholder { color: rgba(255, 255, 255, 0.35); }
.cf-form-section .form-select option { background: #1a1a1a; color: #fff; }
.cf-form-section .text-muted { color: rgba(255, 255, 255, 0.55) !important; font-size: 0.8rem; }

/* Autocomplete */
.cf-autocomplete { position: relative; }
.cf-suggestions {
    position: absolute;
    z-index: 10;
    left: 0; right: 0;
    top: 100%;
    margin: 4px 0 0;
    padding: 4px 0;
    list-style: none;
    background: #1a1a1a;
    border: 1px solid rgba(85, 221, 255, 0.4);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.cf-suggestion {
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    font-size: 0.9rem;
}
.cf-suggestion:hover { background: rgba(85, 221, 255, 0.15); color: #55ddff; }

/* Tabs */
.cf-tabs-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}
.cf-tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.cf-tab-btn:hover { color: #55ddff; }
.cf-tab-btn.active { color: #55ddff; border-bottom-color: #55ddff; }
.cf-tab-pane { display: none; }
.cf-tab-pane.active { display: block; }

/* Detail cards */
.cf-detail-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
}
.cf-detail-card .detail-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.cf-detail-card .detail-value {
    color: #55ddff;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 2px;
}

/* Tip items */
.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.tip-item i { color: #55ddff; margin-top: 3px; flex-shrink: 0; }

/* Outline button */
.btn-outline-light { color: rgba(255, 255, 255, 0.8); border-color: rgba(255, 255, 255, 0.3); }
.btn-outline-light:hover { color: #1a1a1a; background: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.85); }

@media (max-width: 576px) {
    .cf-output-section, .cf-form-section, .cf-tabs-container { padding: 16px; }
    #main-cf-input { font-size: 1.1rem; letter-spacing: 2px; }
    .cf-tab-btn { padding: 8px 12px; font-size: 0.8rem; }
}
