/* ==========================================================================
   ProfilePal "The Clearing" - Password Reset Pages
   ==========================================================================

   Design: Full-viewport dark forest background with centered glassmorphism card.
   Firefly particles float on canvas behind frosted-glass panel.
   Used by: forgot password (email.blade.php) and reset password (reset.blade.php)
   Color system: Forest Green v2
   Fonts: Playfair Display (headings), Inter (body/labels)

   Table of Contents:
   1.  Layout Overrides (hide header/breadcrumb/footer)
   2.  Full Viewport Background
   3.  Canvas & Grain Overlay
   4.  Glassmorphism Card
   5.  Card Modifier (--tall)
   6.  Top Bar (Logo + Back Link)
   7.  (merged into 6)
   8.  Icon Circle
   9.  Title & Subtitle
   10. Form & Fields
   11. Readonly Field
   12. Password Toggle
   13. Validation Errors
   14. Submit Button (shimmer + arrow)
   15. Loading State
   16. Success State
   17. Links
   18. Trust Badges
   19. Entrance Animations (@keyframes)
   20. Staggered Child Animations
   21. Responsive - Tablet (max-width: 768px)
   22. Responsive - Mobile (max-width: 480px)
   23. Responsive - Extra Small (max-width: 380px)
   24. RTL Support
   25. Reduced Motion
   ========================================================================== */


/* ==========================================================================
   1. Layout Overrides
   Hide standard layout chrome when the clearing reset page is present.
   Uses :has() on body to scope overrides without JS.
   ========================================================================== */

body:has(.clearing-reset-page) .header-area,
body:has(.clearing-reset-page) .header-navigation,
body:has(.clearing-reset-page) .breadcrumbs-section,
body:has(.clearing-reset-page) footer,
body:has(.clearing-reset-page) .saas-footer,
body:has(.clearing-reset-page) .footer-area,
body:has(.clearing-reset-page) .footer-widget,
body:has(.clearing-reset-page) .back-to-top,
body:has(.clearing-reset-page) #WAButton,
body:has(.clearing-reset-page) .cookie,
body:has(.clearing-reset-page) .preloader {
    display: none !important;
}

body:has(.clearing-reset-page) {
    overflow: hidden;
    background: #0d1a0d;
}

/* Reset any inherited padding/margin from the layout */
body:has(.clearing-reset-page) main,
body:has(.clearing-reset-page) .main-content {
    padding: 0;
    margin: 0;
}


/* ==========================================================================
   2. Full Viewport Background
   Dark forest gradient fills the entire viewport. The card floats centered.
   ========================================================================== */

.clearing-reset-page {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1a0d 0%, #1a2e1a 40%, #2d4a2d 100%);
    overflow: hidden;
    padding: 40px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


/* ==========================================================================
   3. Canvas & Grain Overlay
   Firefly particle canvas sits behind the card. Grain adds subtle texture.
   ========================================================================== */

.clearing-fireflies {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.clearing-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}


/* ==========================================================================
   4. Glassmorphism Card
   Centered frosted-glass panel. Semi-transparent white with blur backdrop.
   ========================================================================== */

.clearing-card {
    position: relative;
    z-index: 3;
    max-width: 460px;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 48px 40px;
    text-align: center;
    animation: clearingCardEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}


/* ==========================================================================
   5. Card Modifier (--tall)
   Used on the reset password page which has more form fields.
   Slightly more compact vertical spacing to prevent scrollbar.
   ========================================================================== */

.clearing-card--tall {
    padding-top: 40px;
    padding-bottom: 40px;
}

.clearing-card--tall .clearing-icon {
    margin-bottom: 12px;
}

.clearing-card--tall .clearing-title {
    margin-bottom: 6px;
}

.clearing-card--tall .clearing-subtitle {
    margin-bottom: 20px;
}


/* ==========================================================================
   6. Top Bar
   Logo left, back-to-login right. Clean horizontal row at card top.
   ========================================================================== */

.clearing-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Logo - left side */
.clearing-logo {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.clearing-logo:hover {
    opacity: 0.75;
    transform: scale(1.02);
}

.clearing-logo:focus-visible {
    outline: 2px solid rgba(122, 185, 41, 0.5);
    outline-offset: 4px;
    border-radius: 4px;
}

.clearing-logo img {
    max-width: 120px;
    height: auto;
    display: block;
}

/* Back link - right side */
.clearing-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
    transition: all 0.25s ease;
}

.clearing-back-link:hover {
    color: #7ab929;
    border-color: rgba(122, 185, 41, 0.3);
    background: rgba(122, 185, 41, 0.06);
    text-decoration: none;
}

.clearing-back-link:focus-visible {
    outline: 2px solid rgba(122, 185, 41, 0.4);
    outline-offset: 2px;
    border-radius: 8px;
}

.clearing-back-link i {
    font-size: 11px;
    transition: transform 0.25s ease;
}

.clearing-back-link:hover i {
    transform: translateX(-3px);
}


/* ==========================================================================
   8. Icon Circle
   Decorative icon container. Lock icon for forgot, key for reset.
   ========================================================================== */

.clearing-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(122, 185, 41, 0.1);
    margin: 0 auto 16px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.clearing-icon i {
    font-size: 24px;
    color: #7ab929;
    line-height: 1;
}

/* Success variant -- slightly more vivid background, subtle pulse */
.clearing-icon--success {
    background: rgba(122, 185, 41, 0.15);
    animation: clearingSuccessPulse 2s ease-in-out infinite;
}

.clearing-icon--success i {
    color: #7ab929;
    font-size: 28px;
}


/* ==========================================================================
   9. Title & Subtitle
   ========================================================================== */

.clearing-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.clearing-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 28px;
    line-height: 1.55;
}


/* ==========================================================================
   10. Form & Fields
   Clean, rounded inputs with green focus ring. Generous padding for comfort.
   ========================================================================== */

.clearing-form {
    text-align: left;
}

.clearing-field {
    margin-bottom: 20px;
}

.clearing-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.clearing-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #1a1a1a;
    background: #ffffff;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: 1.5;
}

.clearing-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.clearing-input:focus {
    border-color: #7ab929;
    box-shadow: 0 0 0 3px rgba(122, 185, 41, 0.12);
}

.clearing-input:hover:not(:focus):not(.clearing-input--readonly) {
    border-color: #b0b8c1;
}


/* ==========================================================================
   11. Readonly Field
   Muted, non-interactive email field on the reset password page.
   ========================================================================== */

.clearing-input--readonly {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
    user-select: none;
    -webkit-user-select: none;
}

.clearing-input--readonly:focus {
    border-color: #d1d5db;
    box-shadow: none;
}


/* ==========================================================================
   12. Password Toggle
   Eye icon button inside password field for visibility toggling.
   ========================================================================== */

.clearing-password-wrap {
    position: relative;
}

.clearing-password-wrap .clearing-input {
    padding-right: 48px;
}

.clearing-eye-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px 6px;
    color: #9ca3af;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 2;
}

.clearing-eye-toggle:hover {
    color: #7ab929;
}

.clearing-eye-toggle:focus-visible {
    outline: 2px solid rgba(122, 185, 41, 0.4);
    outline-offset: 2px;
    border-radius: 4px;
}


/* ==========================================================================
   13. Validation Errors
   Red error text below invalid fields. Compact, clear.
   ========================================================================== */

.clearing-error {
    color: #ef4444;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 0;
    line-height: 1.4;
    animation: clearingFadeUp 0.3s ease-out both;
}


/* ==========================================================================
   14. Submit Button (shimmer + arrow)
   Full-width green gradient CTA. Arrow slides right on hover.
   Shimmer light-scan effect via ::before pseudo-element.
   ========================================================================== */

.clearing-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #6aa522 0%, #7ab929 50%, #8bc34a 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    line-height: 1.5;
    letter-spacing: 0.01em;
    margin-top: 4px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* Shimmer sweep on hover */
.clearing-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 40%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.1) 60%,
        transparent 100%
    );
    transition: left 0.55s ease;
    z-index: 0;
}

.clearing-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(122, 185, 41, 0.4);
    color: #ffffff;
    text-decoration: none;
}

.clearing-btn:hover::before {
    left: 100%;
}

.clearing-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(122, 185, 41, 0.3);
}

.clearing-btn:focus-visible {
    outline: 2px solid #7ab929;
    outline-offset: 2px;
}

.clearing-btn .btn-text {
    position: relative;
    z-index: 1;
}

.clearing-btn .btn-arrow {
    font-size: 18px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.clearing-btn:hover .btn-arrow {
    transform: translateX(4px);
}

.clearing-btn .btn-spinner {
    position: relative;
    z-index: 1;
}

.clearing-btn .btn-spinner i {
    font-size: 16px;
}


/* ==========================================================================
   15. Loading State
   When form is submitting. Dims button, shows spinner, hides text+arrow.
   ========================================================================== */

.clearing-btn.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

.clearing-btn.is-loading .btn-text,
.clearing-btn.is-loading .btn-arrow {
    opacity: 0;
}

.clearing-btn.is-loading .btn-spinner {
    display: inline-flex !important;
}


/* ==========================================================================
   16. Success State
   Shown after password reset email is sent successfully.
   Centered icon + message + return-to-login button.
   ========================================================================== */

.clearing-success {
    padding: 8px 0 4px;
    animation: clearingFadeUp 0.5s ease-out both;
}

.clearing-success .clearing-icon {
    margin-bottom: 20px;
}

.clearing-success-text {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* The return-to-login button in success state */
.clearing-success .clearing-btn {
    margin-top: 0;
}


/* ==========================================================================
   17. Links
   "Remember your password?" on left, "Sign up" on right.
   ========================================================================== */

.clearing-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.clearing-links a {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
}

.clearing-links a:hover {
    color: #7ab929;
    text-decoration: none;
}

.clearing-link--accent {
    font-weight: 600;
    color: #7ab929 !important;
}

.clearing-link--accent:hover {
    color: #6aa522 !important;
}


/* ==========================================================================
   18. Trust Badges
   Small security indicators at the bottom of the card.
   ========================================================================== */

.clearing-badges {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.clearing-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #9ca3af;
    font-weight: 500;
}

.clearing-badge i {
    color: #7ab929;
    font-size: 13px;
}


/* ==========================================================================
   19. Entrance Animations (@keyframes)
   ========================================================================== */

/* Card entrance -- rises from below with subtle scale */
@keyframes clearingCardEnter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Generic fade-up for staggered children and error messages */
@keyframes clearingFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success icon gentle pulse */
@keyframes clearingSuccessPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(122, 185, 41, 0);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(122, 185, 41, 0);
    }
}


/* ==========================================================================
   20. Staggered Child Animations
   Each card child fades up with incremental delay (80ms apart).
   Starts after the card entrance completes (~0.4s base delay).
   ========================================================================== */

.clearing-card .clearing-topbar {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.clearing-card .clearing-icon {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.clearing-card .clearing-title {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.26s both;
}

.clearing-card .clearing-subtitle {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.34s both;
}

.clearing-card .clearing-form {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
}

.clearing-card .clearing-success {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
}

.clearing-card .clearing-links {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.clearing-card .clearing-badges {
    animation: clearingFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.58s both;
}


/* ==========================================================================
   21. Responsive - Tablet (max-width: 768px)
   Tighter card padding, slightly smaller typography.
   ========================================================================== */

@media (max-width: 768px) {
    .clearing-reset-page {
        padding: 32px 16px;
    }

    .clearing-card {
        padding: 36px 28px;
        border-radius: 18px;
    }

    .clearing-card--tall {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    .clearing-title {
        font-size: 24px;
    }

    .clearing-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .clearing-topbar {
        margin-bottom: 28px;
        padding-bottom: 16px;
    }

    .clearing-logo img {
        max-width: 110px;
    }

    .clearing-badges {
        gap: 20px;
        margin-top: 24px;
        padding-top: 20px;
    }
}


/* ==========================================================================
   22. Responsive - Mobile (max-width: 480px)
   Compact layout for small phones. Inputs enlarged to 16px to prevent iOS zoom.
   ========================================================================== */

@media (max-width: 480px) {
    body:has(.clearing-reset-page) {
        overflow-y: auto;
    }

    .clearing-reset-page {
        padding: 20px 12px;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 40px;
    }

    .clearing-card {
        padding: 28px 20px;
        border-radius: 16px;
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.2),
            0 1px 4px rgba(0, 0, 0, 0.1);
    }

    .clearing-card--tall {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .clearing-title {
        font-size: 22px;
    }

    .clearing-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .clearing-topbar {
        margin-bottom: 24px;
        padding-bottom: 16px;
    }

    .clearing-logo img {
        max-width: 100px;
    }

    .clearing-back-link {
        font-size: 12px;
        padding: 6px 10px;
    }

    .clearing-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    .clearing-icon i {
        font-size: 20px;
    }

    .clearing-input {
        padding: 11px 14px;
        font-size: 16px; /* prevent iOS auto-zoom on focus */
        border-radius: 8px;
    }

    .clearing-label {
        font-size: 13px;
    }

    .clearing-field {
        margin-bottom: 16px;
    }

    .clearing-btn {
        padding: 13px 20px;
        font-size: 15px;
        border-radius: 8px;
    }

    .clearing-links {
        margin-top: 16px;
    }

    .clearing-links a {
        font-size: 13px;
    }

    .clearing-badges {
        gap: 16px;
        margin-top: 20px;
        padding-top: 16px;
    }

    .clearing-badge {
        font-size: 10px;
        letter-spacing: 0.6px;
    }

    .clearing-badge i {
        font-size: 12px;
    }
}


/* ==========================================================================
   23. Responsive - Extra Small (max-width: 380px)
   Further compression for tiny screens.
   ========================================================================== */

@media (max-width: 380px) {
    .clearing-reset-page {
        padding: 12px 8px;
        padding-top: 24px;
    }

    .clearing-card {
        padding: 24px 16px;
        border-radius: 14px;
    }

    .clearing-title {
        font-size: 20px;
    }

    .clearing-badges {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .clearing-links {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}


/* ==========================================================================
   24. RTL Support
   Mirror all directional properties for right-to-left languages.
   ========================================================================== */

/* Back link arrow flips direction */
[dir="rtl"] .clearing-back-link i {
    transform: scaleX(-1);
}

[dir="rtl"] .clearing-back-link:hover {
    transform: translateX(2px);
}

[dir="rtl"] .clearing-back-link:hover i {
    transform: scaleX(-1) translateX(-3px);
}

/* Form text alignment */
[dir="rtl"] .clearing-form {
    text-align: right;
}

/* Password toggle moves to left side */
[dir="rtl"] .clearing-password-wrap .clearing-input {
    padding-right: 16px;
    padding-left: 48px;
}

[dir="rtl"] .clearing-eye-toggle {
    right: auto;
    left: 12px;
}

/* Button arrow flips and animates in mirrored direction */
[dir="rtl"] .clearing-btn .btn-arrow {
    transform: scaleX(-1);
}

[dir="rtl"] .clearing-btn:hover .btn-arrow {
    transform: scaleX(-1) translateX(4px);
}

/* Links row flips */
[dir="rtl"] .clearing-links {
    flex-direction: row-reverse;
}

/* RTL responsive: column layout stays column (no flip needed) */
@media (max-width: 380px) {
    [dir="rtl"] .clearing-links {
        flex-direction: column;
    }
}


/* ==========================================================================
   25. Reduced Motion
   Disable all animations and transitions for users who prefer reduced motion.
   Content renders immediately without any movement.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    /* Kill card entrance animation */
    .clearing-card {
        animation: none !important;
    }

    /* Kill all staggered child animations */
    .clearing-card .clearing-topbar,
    .clearing-card .clearing-icon,
    .clearing-card .clearing-title,
    .clearing-card .clearing-subtitle,
    .clearing-card .clearing-form,
    .clearing-card .clearing-success,
    .clearing-card .clearing-links,
    .clearing-card .clearing-badges {
        animation: none !important;
    }

    /* Kill success pulse */
    .clearing-icon--success {
        animation: none !important;
    }

    /* Kill error fade-up */
    .clearing-error {
        animation: none !important;
    }

    /* Disable all transitions */
    .clearing-logo,
    .clearing-back-link,
    .clearing-back-link i,
    .clearing-icon,
    .clearing-input,
    .clearing-eye-toggle,
    .clearing-btn,
    .clearing-btn::before,
    .clearing-btn .btn-arrow,
    .clearing-links a {
        transition: none !important;
    }

    /* Remove hover transforms */
    .clearing-logo:hover {
        transform: none;
    }

    .clearing-back-link:hover {
        transform: none;
    }

    .clearing-back-link:hover i {
        transform: none;
    }

    .clearing-btn:hover {
        transform: none;
    }

    .clearing-btn:hover .btn-arrow {
        transform: none;
    }

    /* Disable shimmer sweep */
    .clearing-btn:hover::before {
        left: -100%;
    }
}
