/* ==========================================================================
   PORTALE CURE PRIMARIE - Custom CSS
   Schema colori professionale senza viola
   ========================================================================== */

:root {
    /* Colori principali */
    --cp-primary: #1e88e5;        /* Blu professionale */
    --cp-primary-dark: #1565c0;
    --cp-primary-light: #64b5f6;

    --cp-secondary: #546e7a;      /* Grigio blu */
    --cp-secondary-dark: #37474f;

    --cp-success: #2e7d32;        /* Verde scuro */
    --cp-success-light: #4caf50;

    --cp-info: #0097a7;           /* Teal/Ciano */
    --cp-info-light: #00bcd4;

    --cp-warning: #f57c00;        /* Arancione */
    --cp-warning-light: #ff9800;

    --cp-danger: #c62828;         /* Rosso scuro */

    /* Sfondo e testo */
    --cp-bg-light: #f8f9fa;
    --cp-bg-dark: #263238;
    --cp-text: #37474f;
    --cp-text-muted: #78909c;

    /* Bordi e ombre */
    --cp-border: #e0e0e0;
    --cp-shadow: rgba(0, 0, 0, 0.08);
    --cp-shadow-hover: rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   OVERRIDE BOOTSTRAP
   ========================================================================== */

/* Primary */
.bg-primary {
    background-color: var(--cp-primary) !important;
}
.btn-primary {
    background-color: var(--cp-primary);
    border-color: var(--cp-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--cp-primary-dark);
    border-color: var(--cp-primary-dark);
}
.btn-outline-primary {
    color: var(--cp-primary);
    border-color: var(--cp-primary);
}
.btn-outline-primary:hover {
    background-color: var(--cp-primary);
    border-color: var(--cp-primary);
}
.text-primary {
    color: var(--cp-primary) !important;
}
.border-primary {
    border-color: var(--cp-primary) !important;
}

/* Success */
.bg-success {
    background-color: var(--cp-success) !important;
}
.btn-success {
    background-color: var(--cp-success);
    border-color: var(--cp-success);
}
.btn-success:hover {
    background-color: var(--cp-success-light);
    border-color: var(--cp-success-light);
}
.text-success {
    color: var(--cp-success) !important;
}
.border-success {
    border-color: var(--cp-success) !important;
}

/* Info */
.bg-info {
    background-color: var(--cp-info) !important;
}
.btn-info {
    background-color: var(--cp-info);
    border-color: var(--cp-info);
    color: white;
}
.btn-info:hover {
    background-color: var(--cp-info-light);
    border-color: var(--cp-info-light);
    color: white;
}
.text-info {
    color: var(--cp-info) !important;
}
.border-info {
    border-color: var(--cp-info) !important;
}

/* Warning */
.bg-warning {
    background-color: var(--cp-warning) !important;
}
.text-warning {
    color: var(--cp-warning) !important;
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */

.navbar-dark.bg-dark {
    background: linear-gradient(135deg, var(--cp-bg-dark) 0%, #1a252b 100%) !important;
}

.navbar .nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar .nav-link:hover {
    transform: translateY(-1px);
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card.shadow-sm {
    box-shadow: 0 2px 12px var(--cp-shadow) !important;
}

.card:hover {
    box-shadow: 0 4px 20px var(--cp-shadow-hover) !important;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    border-radius: 10px;
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--cp-border);
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--cp-text);
    margin-bottom: 0.375rem;
}

/* Asterisco rosso per campi obbligatori */
.required label::after,
.form-group.required label::after,
.field-required label::after {
    content: " *";
    color: var(--cp-danger);
    font-weight: bold;
}

/* Supporto per Bootstrap 5 con ActiveForm Yii2 */
.mb-3.required > label::after,
.form-floating.required > label::after {
    content: " *";
    color: var(--cp-danger);
    font-weight: bold;
}

/* ==========================================================================
   BADGES
   ========================================================================== */

.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

/* ==========================================================================
   TABLES
   ========================================================================== */

.table {
    --bs-table-hover-bg: rgba(30, 136, 229, 0.04);
}

.table th {
    font-weight: 600;
    border-bottom: 2px solid var(--cp-border);
}

/* Header tabella con sfondo primario - testo bianco */
.table thead th {
    color: #fff !important;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */

.alert {
    border-radius: 10px;
    border: none;
}

.alert-primary {
    background-color: rgba(30, 136, 229, 0.1);
    color: var(--cp-primary-dark);
}

.alert-success {
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--cp-success);
}

.alert-info {
    background-color: rgba(0, 151, 167, 0.1);
    color: var(--cp-info);
}

.alert-warning {
    background-color: rgba(245, 124, 0, 0.1);
    color: var(--cp-warning);
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */

.progress {
    border-radius: 10px;
    background-color: #e3e8ed;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
}

/* ==========================================================================
   WIZARD STEPS
   ========================================================================== */

.wizard-step .step-circle {
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.wizard-step.active .step-circle {
    border-color: var(--cp-primary);
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.3);
}

.wizard-step.completed .step-circle {
    background-color: var(--cp-success) !important;
    border-color: var(--cp-success);
}

.step-connector {
    transition: background 0.3s ease;
}

/* ==========================================================================
   SECTION CARDS (Wizard form sections)
   ========================================================================== */

.section-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--cp-border) !important;
    border-radius: 10px;
}

.section-card h6 {
    color: var(--cp-secondary);
}

/* ==========================================================================
   ISTANZA TYPE CARDS
   ========================================================================== */

.istanza-type-card {
    border-radius: 12px;
    overflow: hidden;
}

.istanza-type-card .icon-circle {
    border-radius: 50%;
}

.istanza-type-card:hover {
    transform: translateY(-5px);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero-section {
    background: linear-gradient(135deg, var(--cp-primary) 0%, var(--cp-primary-dark) 100%) !important;
    border-radius: 16px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
    background-color: var(--cp-bg-light);
    border-top: 1px solid var(--cp-border);
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.rounded-3 {
    border-radius: 12px !important;
}

.shadow-sm {
    box-shadow: 0 2px 12px var(--cp-shadow) !important;
}

/* Colored top borders for cards */
.border-top.border-3 {
    border-top-width: 4px !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* ==========================================================================
   AUTH PAGES (Login, Signup, Reset Password)
   ========================================================================== */

.auth-wrapper {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden;
}

.auth-card .card-header {
    background: linear-gradient(135deg, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
    border: none;
    padding: 2rem 1.5rem;
    text-align: center;
}

.auth-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.auth-icon i {
    font-size: 2.5rem;
    color: white;
}

.auth-card .card-header h4 {
    color: white;
    margin: 0;
    font-weight: 600;
}

.auth-card .card-header p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
}

.auth-card .card-body {
    padding: 2rem 1.5rem;
}

.auth-card .form-floating {
    margin-bottom: 1rem;
}

.auth-card .form-floating .form-control {
    border-radius: 10px;
    border: 2px solid var(--cp-border);
    padding: 1rem 1rem 1rem 3rem;
    height: auto;
    font-size: 1rem;
}

.auth-card .form-floating .form-control:focus {
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.1);
}

.auth-card .form-floating label {
    padding-left: 3rem;
    color: var(--cp-text-muted);
}

.auth-card .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cp-text-muted);
    font-size: 1.1rem;
    z-index: 5;
}

.auth-card .input-group-text {
    background: transparent;
    border: none;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 5;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

.auth-card .btn-auth {
    width: 100%;
    padding: 0.875rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
}

.auth-card .form-check {
    margin: 1rem 0;
}

.auth-card .form-check-label {
    color: var(--cp-text);
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--cp-border);
}

.auth-divider span {
    background: white;
    padding: 0 1rem;
    color: var(--cp-text-muted);
    font-size: 0.9rem;
    position: relative;
}

.auth-links {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--cp-border);
    margin-top: 1.5rem;
}

.auth-links a {
    color: var(--cp-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    color: var(--cp-primary-dark);
    text-decoration: underline;
}

.auth-links p {
    margin: 0.5rem 0;
    color: var(--cp-text-muted);
}

/* Input con icona */
.input-with-icon {
    position: relative;
}

.input-with-icon .form-control {
    padding-left: 3rem !important;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cp-text-muted);
    z-index: 5;
}

.input-with-icon .form-control:focus + .input-icon,
.input-with-icon .form-control:focus ~ .input-icon {
    color: var(--cp-primary);
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--cp-text-muted);
    cursor: pointer;
    z-index: 5;
    padding: 0;
}

.password-toggle:hover {
    color: var(--cp-primary);
}

/* Hint text */
.auth-card .form-text {
    font-size: 0.8rem;
    color: var(--cp-text-muted);
    margin-top: 0.25rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .hero-section {
        border-radius: 0;
        margin: -1rem -0.75rem 1.5rem;
        padding: 2rem 1rem !important;
    }

    .card {
        border-radius: 10px;
    }

    .btn-lg {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }

    .auth-wrapper {
        padding: 1rem 0;
        min-height: auto;
    }

    .auth-card {
        margin: 0 0.5rem;
        border-radius: 12px !important;
    }

    .auth-card .card-header {
        padding: 1.5rem 1rem;
    }

    .auth-icon {
        width: 60px;
        height: 60px;
    }

    .auth-icon i {
        font-size: 1.8rem;
    }

    .auth-card .card-body {
        padding: 1.5rem 1rem;
    }
}
