/* =============================================
   Auth Pages - Standalone CSS
   Login, Forgot Password, Reset Password
   Layout desktop two-panel (brand + form)
   ============================================= */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8f9fa;
    display: flex;
    align-items: stretch;
}

/* ===== LAYOUT PRINCIPALE ===== */
.rp-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* --- Pannello sinistro (brand) --- */
.rp-brand {
    width: 420px;
    min-width: 420px;
    background: linear-gradient(160deg, #d62a31 0%, #b01e24 50%, #8a1820 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.rp-brand::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
}

.rp-brand::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    border-radius: 50%;
}

.rp-brand-logo {
    max-width: 240px;
    height: auto;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.rp-brand-title {
    color: rgba(255,255,255,0.95);
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.rp-brand-subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.6;
    max-width: 300px;
    position: relative;
    z-index: 1;
}

.rp-brand-footer {
    position: absolute;
    bottom: 2rem;
    color: rgba(255,255,255,0.4);
    font-size: 0.75rem;
    z-index: 1;
}

/* --- Pannello destro (form) --- */
.rp-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 4rem;
    background: #fff;
    position: relative;
}

.rp-form-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #d62a31, #e84a50, #d62a31);
}

.rp-form-container {
    width: 100%;
    max-width: 480px;
    animation: rpFadeIn 0.6s ease-out;
}

@keyframes rpFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER FORM ===== */
.rp-header {
    margin-bottom: 2.5rem;
}

.rp-header-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.rp-header-icon i {
    font-size: 1.5rem;
    color: #d62a31;
}

.rp-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}

.rp-header p {
    color: #6b7280;
    font-size: 0.925rem;
    line-height: 1.6;
}

.rp-header p strong {
    color: #1a1a2e;
}

/* ===== FORM ELEMENTS ===== */
.rp-form-group {
    margin-bottom: 1.5rem;
}

.rp-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.rp-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.rp-input-wrap i.rp-input-icon {
    position: absolute;
    left: 14px;
    color: #9ca3af;
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}

.rp-input {
    width: 100%;
    padding: 13px 14px 13px 44px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fafafa;
    transition: all 0.2s ease;
    color: #1a1a2e;
}

.rp-input:hover {
    border-color: #d1d5db;
    background: #fff;
}

.rp-input:focus {
    border-color: #d62a31;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(214, 42, 49, 0.1);
}

.rp-input:focus ~ i.rp-input-icon,
.rp-input-wrap:focus-within i.rp-input-icon {
    color: #d62a31;
}

.rp-input.has-eye {
    padding-right: 48px;
}

/* Eye toggle */
.rp-eye-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 1.05rem;
    transition: color 0.2s;
    z-index: 2;
}

.rp-eye-btn:hover {
    color: #d62a31;
}

/* ===== PASSWORD STRENGTH ===== */
.rp-strength {
    height: 4px;
    border-radius: 4px;
    background: #e5e7eb;
    margin-top: 8px;
    overflow: hidden;
}

.rp-strength-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s, background 0.3s;
}

.rp-strength-label {
    font-size: 0.75rem;
    margin-top: 4px;
    font-weight: 600;
}

/* ===== PASSWORD REQUIREMENTS ===== */
.rp-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
}

.rp-req {
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.rp-req i {
    font-size: 0.7rem;
}

.rp-req.valid {
    color: #22c55e;
}

/* ===== BUTTONS ===== */
.rp-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #d62a31, #c4252b);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

.rp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(214, 42, 49, 0.3);
}

.rp-btn:active {
    transform: translateY(0);
}

.rp-btn:disabled {
    opacity: 0.7;
    pointer-events: none;
}

.rp-btn.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: rpSpin 0.7s linear infinite;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes rpSpin {
    to { transform: rotate(360deg); }
}

/* Link secondario (errore view) */
.rp-btn-outline {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #d62a31;
    border: 2px solid #d62a31;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.rp-btn-outline:hover {
    background: #d62a31;
    color: #fff;
}

/* ===== MESSAGES ===== */
.rp-msg {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: rpFadeIn 0.4s ease-out;
}

.rp-msg i {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.rp-msg--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.rp-msg--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    animation: rpShake 0.4s ease-in-out;
}

.rp-msg--info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

@keyframes rpShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* ===== BACK LINK ===== */
.rp-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2rem;
    color: #6b7280;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s;
}

.rp-back:hover {
    color: #d62a31;
}

/* ===== ERROR VIEW (token scaduto) ===== */
.rp-error-view {
    text-align: center;
    padding: 1rem 0;
}

.rp-error-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.rp-error-icon i {
    font-size: 2rem;
    color: #dc2626;
}

.rp-error-view h2 {
    color: #1a1a2e;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.rp-error-view p {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== SUCCESS VIEW ===== */
.rp-success-view {
    text-align: center;
    padding: 1rem 0;
}

.rp-success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: rpPulse 2s ease-in-out infinite;
}

@keyframes rpPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
}

.rp-success-icon i {
    font-size: 2rem;
    color: #22c55e;
}

.rp-success-view h2 {
    color: #1a1a2e;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.rp-success-view p {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
}

.rp-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
    padding: 10px 20px;
    background: #f3f4f6;
    border-radius: 10px;
    color: #6b7280;
    font-size: 0.85rem;
}

.rp-countdown span {
    font-weight: 700;
    color: #d62a31;
    font-size: 1rem;
}

/* ===== TWO COLUMNS PASSWORD ===== */
.rp-row {
    display: flex;
    gap: 1rem;
}

.rp-row .rp-form-group {
    flex: 1;
}

/* ===== LOGIN SPECIFIC ===== */
.rp-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.rp-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.rp-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #d62a31;
    cursor: pointer;
    border-radius: 4px;
}

.rp-remember label {
    font-size: 0.875rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

.rp-forgot-link {
    font-size: 0.875rem;
    color: #d62a31;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.rp-forgot-link:hover {
    color: #b01e24;
    text-decoration: underline;
}

/* ===== FOOTER (mobile) ===== */
.rp-footer-mobile {
    display: none;
    text-align: center;
    padding: 1.5rem;
    color: #9ca3af;
    font-size: 0.75rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .rp-wrapper {
        flex-direction: column;
    }

    .rp-brand {
        width: 100%;
        min-width: unset;
        min-height: auto;
        padding: 2rem 1.5rem;
        flex-direction: row;
        gap: 1rem;
    }

    .rp-brand-logo {
        max-width: 120px;
        margin-bottom: 0;
    }

    .rp-brand-title,
    .rp-brand-subtitle,
    .rp-brand-footer {
        display: none;
    }

    .rp-form-panel {
        padding: 2rem 1.5rem;
    }

    .rp-form-panel::before {
        display: none;
    }

    .rp-row {
        flex-direction: column;
        gap: 0;
    }

    .rp-footer-mobile {
        display: block;
    }
}

@media (max-width: 480px) {
    .rp-form-container {
        max-width: 100%;
    }
}
