:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fb;
    --bg-brand: #faf7f2;
    --bg-input: #ffffff;
    --border-color: #e2e5eb;
    --border-focus: #e8732c;
    --text-primary: #1a1d26;
    --text-secondary: #4b5064;
    --text-muted: #8b90a0;
    --orange: #e8732c;
    --orange-hover: #d4621e;
    --orange-light: rgba(232, 115, 44, 0.08);
    --orange-glow: rgba(232, 115, 44, 0.18);
    --green: #2db87a;
    --green-hover: #26a46c;
    --green-light: rgba(45, 184, 122, 0.08);
    --danger: #e54d4d;
    --danger-light: rgba(229, 77, 77, 0.08);
    --warning: #e8a12c;
    --warning-light: rgba(232, 161, 44, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== PANNELLO SINISTRO ===== */
.brand-panel {
    flex: 0 0 45%;
    background: var(--bg-brand);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

    .brand-panel::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(ellipse at 25% 40%, rgba(232,115,44,0.07) 0%, transparent 55%), radial-gradient(ellipse at 75% 65%, rgba(45,184,122,0.06) 0%, transparent 55%), radial-gradient(ellipse at 50% 20%, rgba(232,161,44,0.04) 0%, transparent 50%);
        animation: drift 25s ease-in-out infinite;
    }

@keyframes drift {
    0%, 100% {
        transform: translate(0,0) rotate(0deg);
    }

    33% {
        transform: translate(2%,-2%) rotate(0.5deg);
    }

    66% {
        transform: translate(-1%,1%) rotate(-0.3deg);
    }
}

.brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(232,115,44,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(232,115,44,0.04) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 25%, transparent 72%);
}

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 400px;
}

.brand-logo {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--orange), var(--green));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    font-size: 1.65rem;
    color: white;
    box-shadow: 0 6px 24px rgba(232,115,44,0.22), 0 2px 8px rgba(45,184,122,0.12);
    animation: logoAppear 0.8s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes logoAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 2.15rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    animation: fadeUp 0.6s 0.2s cubic-bezier(0.16,1,0.3,1) both;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.65;
    animation: fadeUp 0.6s 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.brand-features {
    margin-top: 2.75rem;
    text-align: left;
    animation: fadeUp 0.6s 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.7rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.feature-dot {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

    .feature-dot.orange {
        background: var(--orange-light);
        color: var(--orange);
    }

    .feature-dot.green {
        background: var(--green-light);
        color: var(--green);
    }

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.brand-corner-deco {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    gap: 6px;
    z-index: 1;
}

    .brand-corner-deco span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        opacity: 0.5;
    }

        .brand-corner-deco span:nth-child(1) {
            background: var(--orange);
        }

        .brand-corner-deco span:nth-child(2) {
            background: var(--green);
        }

        .brand-corner-deco span:nth-child(3) {
            background: var(--orange);
            opacity: 0.3;
        }

/* ===== PANNELLO DESTRO ===== */
.form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-primary);
    position: relative;
}

    .form-panel::before {
        content: '';
        position: absolute;
        left: 0;
        top: 10%;
        bottom: 10%;
        width: 1px;
        background: linear-gradient(to bottom, transparent, var(--border-color), transparent);
    }

.form-container {
    width: 100%;
    max-width: 400px;
    animation: formAppear 0.7s 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes formAppear {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== SECTIONS ===== */
.form-section {
    display: none;
}

    .form-section.active {
        display: block;
        animation: sectionIn 0.35s cubic-bezier(0.16,1,0.3,1);
    }

@keyframes sectionIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-header {
    margin-bottom: 2rem;
}

    .form-header h2 {
        font-family: 'Outfit', sans-serif;
        font-weight: 700;
        font-size: 1.7rem;
        letter-spacing: -0.01em;
        margin-bottom: 0.5rem;
        color: var(--text-primary);
    }

    .form-header p {
        color: var(--text-muted);
        font-size: 0.92rem;
        line-height: 1.55;
    }

/* ===== INPUTS ===== */
.form-floating-custom {
    position: relative;
    margin-bottom: 1.125rem;
}

    .form-floating-custom .form-control {
        background: var(--bg-input);
        border: 1.5px solid var(--border-color);
        border-radius: 11px;
        color: var(--text-primary);
        padding: 0.9rem 1rem 0.9rem 2.85rem;
        height: 52px;
        font-size: 0.935rem;
        font-family: 'Inter', sans-serif;
        transition: all 0.25s ease;
    }

        .form-floating-custom .form-control:focus {
            background: var(--bg-input);
            border-color: var(--border-focus);
            box-shadow: 0 0 0 3px var(--orange-glow);
            color: var(--text-primary);
            outline: none;
        }

        .form-floating-custom .form-control::placeholder {
            color: var(--text-muted);
        }

.input-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.05rem;
    transition: color 0.25s;
    z-index: 4;
}

.form-floating-custom .form-control:focus ~ .input-icon {
    color: var(--orange);
}

.toggle-password {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    z-index: 4;
    transition: color 0.2s;
}

    .toggle-password:hover {
        color: var(--text-secondary);
    }

/* ===== BUTTONS ===== */
.btn-login {
    width: 100%;
    padding: 0.825rem;
    border: none;
    border-radius: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.975rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: var(--orange);
    color: white;
    margin-top: 0.5rem;
    transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
}

    .btn-login:hover {
        background: var(--orange-hover);
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(232,115,44,0.28);
    }

    .btn-login:active {
        transform: translateY(0);
    }

    .btn-login:disabled {
        opacity: 0.55;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    .btn-login .spinner-border {
        width: 1.15rem;
        height: 1.15rem;
        border-width: 2px;
    }

.btn-green {
    background: var(--green);
}

    .btn-green:hover {
        background: var(--green-hover);
        box-shadow: 0 6px 20px rgba(45,184,122,0.28);
    }

.btn-secondary-custom {
    width: 100%;
    padding: 0.825rem;
    border: 1.5px solid var(--border-color);
    border-radius: 11px;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.935rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 0.75rem;
}

    .btn-secondary-custom:hover {
        border-color: var(--text-muted);
        color: var(--text-primary);
        background: var(--bg-secondary);
    }

/* ===== LINKS ===== */
.form-link {
    color: var(--orange);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    cursor: pointer;
    transition: color 0.2s;
}

    .form-link:hover {
        color: var(--orange-hover);
        text-decoration: underline;
    }

.forgot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.35rem;
}

/* ===== ALERTS ===== */
.alert-custom {
    border-radius: 11px;
    padding: 0.8rem 1rem;
    font-size: 0.885rem;
    display: none;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.125rem;
    border: 1px solid transparent;
    animation: alertIn 0.3s ease;
}

    .alert-custom.show {
        display: flex;
    }

.alert-danger-custom {
    background: var(--danger-light);
    border-color: rgba(229,77,77,0.15);
    color: var(--danger);
}

.alert-success-custom {
    background: var(--green-light);
    border-color: rgba(45,184,122,0.15);
    color: var(--green);
}

.alert-warning-custom {
    background: var(--warning-light);
    border-color: rgba(232,161,44,0.15);
    color: #b07a16;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PASSWORD STRENGTH ===== */
.password-strength {
    margin-top: 0.4rem;
    margin-bottom: 0.9rem;
}

.strength-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 0.3rem;
}

.strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--border-color);
    transition: background 0.3s;
}

    .strength-bar.weak {
        background: var(--danger);
    }

    .strength-bar.medium {
        background: var(--warning);
    }

    .strength-bar.strong {
        background: var(--green);
    }

.strength-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== SUCCESS ===== */
.success-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--green-light);
    border: 2px solid rgba(45,184,122,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--green);
    animation: successPop 0.5s cubic-bezier(0.16,1,0.3,1);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== FOOTER ===== */
.form-footer {
    margin-top: 2.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ===== CHECKBOX ===== */
.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.125rem;
    cursor: pointer;
}

    .form-check-input:checked {
        background-color: var(--orange);
        border-color: var(--orange);
    }

    .form-check-input:focus {
        box-shadow: 0 0 0 3px var(--orange-glow);
        border-color: var(--border-focus);
    }

.form-check-label {
    color: var(--text-secondary);
    font-size: 0.88rem;
    cursor: pointer;
    user-select: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .brand-panel {
        display: none;
    }

    .form-panel {
        padding: 1.5rem;
    }

        .form-panel::before {
            display: none;
        }

    .form-container {
        max-width: 100%;
    }

    .mobile-brand {
        display: flex !important;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 2.25rem;
    }

        .mobile-brand .brand-logo {
            width: 42px;
            height: 42px;
            border-radius: 11px;
            margin: 0;
            font-size: 1.05rem;
        }

        .mobile-brand .brand-title {
            font-size: 1.2rem;
            margin: 0;
        }
}

@media (min-width: 992px) {
    .mobile-brand {
        display: none !important;
    }
}
