/* IFM Login Page Styling - Shadcn/ui Inspired */

:root {
    /* Shadcn/ui Base Variables - HSL Format */
    --background: 0 0% 98%;
    --foreground: 220 13% 18%;

    --card: 0 0% 100%;
    --card-foreground: 220 13% 18%;

    --popover: 0 0% 100%;
    --popover-foreground: 220 13% 18%;

    /* Brand Primary from Frontend config */
    --primary: 285 56% 45%;
    --primary-foreground: 0 0% 100%;

    --secondary: 220 14% 96%;
    --secondary-foreground: 220 13% 18%;

    --muted: 220 14% 96%;
    --muted-foreground: 220 9% 46%;

    --accent: 285 20% 95%;
    --accent-foreground: 285 56% 40%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;

    --border: 220 13% 91%;
    --input: 220 13% 91%;
    --ring: 285 56% 45%;
    /* Same as primary usually */

    --radius: 0.5rem;
    /* rounded-md equivalent roughly */

    /* Extra brand gradients */
    --gradient-primary: linear-gradient(135deg, hsl(285 56% 45%), hsl(330 65% 50%));
    --login-title-font: "Manrope", "Poppins", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;

    /* Professional background image - Custom image */
    background-image: url('/assets/ff_ifm/images/bg-image.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;

    /* Fallback color if image fails to load */
    background-color: #f0f4f8;
}

/*
   ------------------------------------------
   Card UI (Login Box)
   ------------------------------------------
   Matches: rounded-xl border bg-card text-card-foreground shadow
*/
.page-card,
.custom-login-card {
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    /* modern xl radius */

    /* Enhanced shadow for depth and prominence */
    box-shadow:
        0 20px 25px -5px rgba(102, 126, 234, 0.15),
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.5);
    /* shadow-lg with accent color + subtle inset highlight */

    max-width: 520px;
    width: 100%;
    padding: 0 !important;
    overflow: hidden;
    margin: 0 auto;
    /* Center it */

    /* Subtle backdrop blur effect */
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

/* Override Frappe section padding */
.login-content {
    padding-top: 4vh !important;
    padding-bottom: 4vh !important;
}

/* Header inside card */
.page-card .page-card-head,
.custom-login-card .page-card-head {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    /* Pt Pr Pb Pl */

    /* Subtle gradient header background */
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    /* Cleaner look with subtle separator */

    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Ensure logo container spacing is tight */
.login-logo-container {
    margin-bottom: 0.25rem !important;
}

.page-card .page-card-head h4,
.custom-login-card .page-card-head h4 {
    font-family: var(--login-title-font);
    font-weight: 600;
    letter-spacing: -0.03em;
    font-size: 1.25rem;
    margin: 0 !important;
    /* Managed by flex gap */
}

/* Content inside card */
.page-card .page-card-body,
.custom-login-card .page-card-body {
    padding: 0 1.75rem 1.75rem 1.75rem;
    /* Pt Pr Pb Pl */
}

/* Make login form controls wider in the card */
.page-card .page-card-body form,
.custom-login-card .page-card-body form {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.page-card .page-card-body .form-group,
.custom-login-card .page-card-body .form-group {
    width: 100%;
}

/* Form Group Spacing - reduce gap */
.form-group {
    margin-bottom: 1rem !important;
}

.form-group:last-child {
    margin-bottom: 0 !important;
}

/*
   ------------------------------------------
   Input Fields - Modern UI
   ------------------------------------------
   Enhanced with modern styling, better focus states, and smooth transitions
*/
.form-control {
    display: flex;
    height: 2.75rem;
    /* h-11 - slightly taller for better touch targets */
    width: 100%;
    border-radius: 0.625rem;
    /* Modern rounded corners */
    border: 1px solid hsl(var(--input));
    background-color: rgba(255, 255, 255, 0.9);
    /* Subtle white background instead of transparent */
    padding: 0.625rem 1rem;
    /* Increased padding for better spacing */
    font-size: 0.9375rem;
    /* text-base - slightly larger for better readability */
    line-height: 1.5rem;
    color: hsl(var(--foreground));
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Smooth easing for all transitions */
}

.form-control::placeholder {
    color: hsl(var(--muted-foreground));
    font-weight: 400;
}

.form-control:hover {
    /* Subtle hover effect */
    border-color: hsl(var(--ring) / 0.6);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--ring)) !important;
    /* Bright ring color on focus */
    background-color: rgba(255, 255, 255, 1);
    /* Full white on focus */
    box-shadow:
        0 0 0 2px hsl(var(--ring) / 0.22),
        0 4px 12px rgba(102, 126, 234, 0.16) !important;
    /* Thinner focus ring */
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: hsl(var(--muted));
}

/* Label adjustments - Modern */
.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    /* Bolder labels */
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
    /* Increased spacing */
    display: block;
    letter-spacing: 0.3px;
    /* Slight letter spacing for elegance */
}

/* Fix input icons if present (font awesome / lucide) */
.form-group .input-group-prepend .input-group-text,
.form-group .input-group-append .input-group-text {
    background: transparent;
    border-color: hsl(var(--input));
    color: hsl(var(--muted-foreground));
    border: none;
    padding: 0 0.75rem;
}

/* Input group styling */
.input-group {
    position: relative;
}

/* Modern input with icon styling */
.form-group .input-with-icon {
    position: relative;
}

.form-group .input-with-icon .form-control {
    padding-left: 2.5rem;
    /* Make room for icon */
}

.form-group .input-with-icon .input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--muted-foreground));
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/*
   ------------------------------------------
   Buttons
   ------------------------------------------
   Matches: inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90
*/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.5rem;
    /* h-10 */
    padding-left: 1rem;
    padding-right: 1rem;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
    cursor: pointer;
}

.btn-primary {
    background: var(--gradient-primary) !important;
    /* Using brand gradient preferrably, or just hsl(var(--primary)) */
    /* If strict shadcn: background-color: hsl(var(--primary)); */
    color: hsl(var(--primary-foreground)) !important;
    border: none;

    /* Enhanced button shadow */
    box-shadow:
        0 10px 15px -3px rgba(102, 126, 234, 0.3),
        0 4px 6px -2px rgba(102, 126, 234, 0.2);
    /* shadow-lg with accent color */

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    opacity: 0.9;
    /* hover:bg-primary/90 */
    transform: translateY(-2px);
    /* Subtle lift effect on hover */
    box-shadow:
        0 15px 30px -5px rgba(102, 126, 234, 0.4),
        0 10px 15px -3px rgba(102, 126, 234, 0.3);
}

.btn-primary:focus-visible,
.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.btn-default {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: none;
}

.btn-default:hover {
    background-color: hsl(var(--secondary) / 0.8);
    /* secondary/80 */
}

/* Links (Forgot Password etc) */
a {
    color: hsl(var(--primary));
    font-weight: 500;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Footer / Copyright / Powered By */
.footer {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Logo Sizing */
.app-logo {
    max-height: 48px;
    width: auto;
    margin-bottom: 0.5rem;
}

/* Hero Logo Section - Large Logo Above Card - NOW ENABLED */
.login-hero-logo-section {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.6s ease-out;
}

.login-hero-logo-large {
    max-width: 48px;
    width: 100%;
    height: auto;
    margin: 0 auto 1rem auto;
    display: block;
    filter: drop-shadow(0 10px 20px rgba(102, 126, 234, 0.2));
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Logo Container - Text/Subtitle - NOW ENABLED */
.hero-logo-subtitle {
    font-family: var(--login-title-font);
    font-size: 1rem;
    color: hsl(var(--foreground));
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-top: 0.5rem;
    text-wrap: balance;
}

/* Hide h4 elements outside card header */
.login-content > h4,
.login-footer > h4,
body > h4 {
    display: none !important;
}

/* Hide any images outside card header */
.login-content > img,
.login-footer > img {
    display: none !important;
}

/* Login Hero Image - Inside Card */
.login-hero-image {
    width: 100%;
    height: auto;
    max-height: 220px;
    margin-bottom: 1.5rem;
    border-radius: calc(var(--radius) + 0.25rem);
    display: block;
    object-fit: contain;
    animation: fadeIn 0.8s ease-out 0.2s backwards;
    visibility: hidden !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.login-hero-container {
    width: 100%;
    text-align: center;
    margin-bottom: 0;
}

/* Remove default frappe shadows/borders if they interfere */
.frappe-card {
    border: none !important;
    box-shadow: none !important;
}

#page-login .page-card-body {
    padding-bottom: 1px !important;
}

#page-login .form-group .field-icon, #page-login .form-group .toggle-password {
    margin-top: 7px !important;
}

/* Responsive Login Image Styling */
@media (max-width: 576px) {
    .login-hero-logo-section {
        margin-bottom: 2rem;
    }

    .login-hero-logo-large {
        max-width: 220px;
    }

    .login-hero-image {
        max-height: 180px;
        margin-bottom: 1rem;
    }

    .page-card,
    .custom-login-card {
        max-width: 100%;
        width: calc(100% - 2rem) !important;
        margin: 0 auto;
    }

    .hero-logo-subtitle {
        font-size: 1.35rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .login-hero-logo-large {
        max-width: 250px;
    }

    .login-hero-image {
        max-height: 200px;
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 480px) {
    .login-hero-logo-section {
        margin-bottom: 1.5rem;
    }

    .login-hero-logo-large {
        max-width: 180px;
    }

    .page-card .page-card-head,
    .custom-login-card .page-card-head {
        padding: 1rem 1rem 0.75rem 1rem;
    }

    .login-hero-image {
        max-height: 160px;
        margin-bottom: 0.75rem;
    }

    .page-card .page-card-head h4,
    .custom-login-card .page-card-head h4 {
        font-size: 1.25rem;
    }

    .hero-logo-subtitle {
        font-size: 1.2rem;
    }
}
