/* =============================================================================
   BLOCCO: Stili form, input, bottoni, modali — Archivia V1.0

   Scopo:
     Stili per tutti gli elementi interattivi: form, campi input,
     pulsanti, select, modale overlay.

   Vincoli:
     - Pulsanti azzurri #3b82f6 con hover #2563eb e testo bianco
     - Transizione colore 0.2s su hover
     - Border-radius 10px sui pulsanti
     - Nessun CSS inline, nessun framework

   Ultima modifica: 17/02/2026 | v1.0
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Form layout
   ----------------------------------------------------------------------------- */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -----------------------------------------------------------------------------
   Label
   ----------------------------------------------------------------------------- */

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

/* -----------------------------------------------------------------------------
   Input, textarea, select
   ----------------------------------------------------------------------------- */

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: #fcfdff;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(79, 157, 255, 0.16);
}

.form-input::placeholder {
    color: var(--color-text-light);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    cursor: pointer;
    appearance: auto;
}

/* Input file */
.form-input-file {
    padding: 8px 0;
    border: none;
    background: transparent;
    font-size: 0.9rem;
}

/* -----------------------------------------------------------------------------
   Pulsanti
   ----------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
}

/* Primary: azzurro pieno */
.btn-primary {
    background: #d8ebff;
    color: #123c8c;
    border-color: rgba(79, 157, 255, 0.45);
}

.btn-primary:hover {
    background: #c8e3ff;
    border-color: rgba(79, 157, 255, 0.62);
    color: #0f357d;
    box-shadow: 0 4px 14px rgba(79, 157, 255, 0.28);
}

/* Secondary: outline azzurro */
.btn-secondary {
    background: #eff6ff;
    color: #1e3a8a;
    border-color: var(--color-border-strong);
}

.btn-secondary:hover {
    background: #e4f1ff;
    border-color: var(--color-accent);
}

/* Ghost: minimalista */
.btn-ghost {
    background: #fbfdff;
    color: #1e3a8a;
    border-color: var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-strong);
}

/* Danger */
.btn-danger {
    background: rgba(220, 38, 38, 0.08);
    color: var(--color-error);
    border-color: rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.35);
}

/* Piccolo */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Full width */
.btn-full {
    width: 100%;
}

/* Disabilitato */
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -----------------------------------------------------------------------------
   Modale
   ----------------------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: min(560px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
