/**
 * =============================================================================
 * LOGIN PAGE STYLESHEET
 * =============================================================================
 * 
 * Project: Peace Lutheran Childcare Calendar (PLCC)
 * File: login.css
 * 
 * Purpose:
 * --------
 * Main stylesheet for the login page. Also serves as a base stylesheet that
 * is imported by the choose_role.html page for consistent styling.
 * 
 * Shared Styles:
 * --------------
 * The following styles are reused by other pages:
 * - Navbar styles (navbar, navbar-brand, navbar-logo, navbar-title)
 * - Wrapper container
 * - Form styling
 * - Toast notifications
 * - Role card buttons (for choose_role page)
 * 
 * Page Structure:
 * ---------------
 * - Full-height body with background image
 * - Fixed navbar at top
 * - Centered white wrapper container with form
 * 
 * =============================================================================
 */

/* =============================================================================
   GOOGLE FONTS IMPORT
   ============================================================================= */
/* Nunito - friendly, rounded font used throughout the application */
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');

/* =============================================================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================================================= */
/* 
 * These variables allow easy theming and are shared with choose_role.css
 */
:root{
    /* Primary brand color - purple */
    --accent-color: rgb(104, 44, 128);
    
    /* Base/background color - white */
    --base-color: rgb(255, 255, 255);
    
    /* Text color - black */
    --text-color: rgb(0, 0, 0);
    
    /* Form input background - light purple */
    --input-color: rgb(212, 163, 255); 
    
    /* Role button styles (used by choose_role page) */
    --role-btn-bg: #f4f0f9;           /* Default background */
    --role-btn-border: #d8c9ec;       /* Default border */
    --role-btn-hover: #e1d6f3;        /* Hover background */
    --role-btn-active: #6930c3;       /* Selected/active background */
    --role-btn-active-text: #fff;     /* Selected/active text color */
}

/* =============================================================================
   UNIVERSAL RESET
   ============================================================================= */
/* Remove default browser margins and padding */
*{
    margin: 0;
    padding: 0;
}

/* =============================================================================
   HTML ROOT STYLES
   ============================================================================= */
html{
    font-family: Nunito;
    font-size: 12pt;
    color: var(--text-color);
    text-align: center;
}

/* =============================================================================
   BODY STYLES
   ============================================================================= */
body{
    min-height: 100vh;             /* Full viewport height */
    background-image: url('/calendar/media/login_bg.jpg');
    background-size: cover;        /* Cover entire background */
    background-position: right;    /* Align background to right */
    overflow: hidden;              /* Prevent scrollbars */
    padding-top: 80px;             /* Space for fixed navbar */
}

/* =============================================================================
   NAVIGATION BAR
   ============================================================================= */
/* Fixed navbar at top of page with organization branding */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--accent-color);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;                  /* Above all other content */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Navbar branding container (logo + title) */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Organization logo image */
.navbar-logo {
    height: 40px;
    width: auto;
    border-radius: 4px;
}

/* Organization title text */
.navbar-title {
    color: var(--base-color);
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

/* =============================================================================
   MAIN WRAPPER CONTAINER
   ============================================================================= */
/* White card container that holds the form */
.wrapper{
    box-sizing: border-box;
    background-color: var(--base-color);
    height: 100vh;
    width: max(40%, 600px);        /* At least 40% or 600px */
    padding: 10px;
    border-radius: 0 20px 20px 0;  /* Rounded corners on right side */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* =============================================================================
   PAGE HEADING
   ============================================================================= */
h1{
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
}

/* =============================================================================
   FORM CONTAINER
   ============================================================================= */
/* 
 * Centered form with vertical layout
 * Uses min() for responsive width capping
 */
form{
    width: min(400px, 100%);       /* Max 400px or 100% on small screens */
    margin-top: 20px;
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;                     /* Spacing between form rows */
}

/* =============================================================================
   FORM ROW CONTAINERS
   ============================================================================= */
/* Each form row contains a label + input pair */
form > div{
    width: 100%;
    display: flex;
    justify-content: center;
}

/* =============================================================================
   FORM LABELS (Icon Containers)
   ============================================================================= */
/* 
 * Square icon containers attached to left side of inputs
 * Contains SVG icons or text characters
 */
form label{
    flex-shrink: 0;               /* Don't shrink below size */
    height: 50px;
    width: 50px;
    background-color: var(--accent-color);
    fill: var(--base-color);      /* For SVG icons */
    color: var(--base-color);     /* For text icons */
    border-radius: 10px 0 0 10px; /* Rounded left corners only */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 500;
}

/* =============================================================================
   FORM INPUT FIELDS
   ============================================================================= */
/* 
 * Text inputs attached to labels with connected border radius
 * Purple background that transitions on hover/focus
 */
form input{
    box-sizing: border-box;
    flex-grow: 1;                 /* Fill remaining space */
    min-width: 0;                 /* Allow shrinking below content size */
    height: 50px;
    padding: 1em;
    font: inherit;
    border-radius: 0 10px 10px 0; /* Rounded right corners only */
    border: 2px solid var(--input-color);
    border-left: none;            /* Label handles left border */
    background-color: var(--input-color);
    transition: 150ms ease;
}

/* =============================================================================
   INPUT INTERACTIVE STATES
   ============================================================================= */
/* Hover: highlight border with accent color */
form input:hover{
    border-color: var(--accent-color);
}

/* Focus: stronger border color, remove default outline */
form input:focus{
    outline: none;
    border-color: var(--text-color);
}

/* When input is focused, darken the adjacent label */
div:has(input:focus) > label{
    background-color: var(--text-color);
}

/* Placeholder text styling - ensure full opacity */
form input::placeholder{
    color: var(--text-color);
    opacity: 1;                   /* Override browser default opacity */
}

/* =============================================================================
   PASSWORD VISIBILITY TOGGLE
   ============================================================================= */
/* When the password field has a toggle, remove its right radius so it flows
   seamlessly into the toggle button */
.pw-group input {
    border-radius: 0 !important;
}

/* The toggle button sits flush against the right edge of the input */
.pw-toggle {
    flex: 0 0 46px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    border: 2px solid var(--input-color);
    border-left: none;
    border-radius: 0 10px 10px 0 !important;
    background-color: var(--input-color) !important;
    color: var(--accent-color);
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease;
}

.pw-toggle:hover {
    color: var(--text-color);
}

/* Keep toggle border in sync with the sibling input's focus state */
.pw-group:has(input:focus) .pw-toggle {
    border-color: var(--text-color);
}

/* =============================================================================
   SUBMIT BUTTON
   ============================================================================= */
/* 
 * Pill-shaped button with wide horizontal padding
 * Color transition on hover/focus
 */
form button{
    margin-top: 10px;
    border: none;
    border-radius: 1000px;        /* Pill shape (high value for rounded ends) */
    padding: .85em 4em;           /* Wide horizontal padding */
    background-color: var(--accent-color);
    color: var(--base-color);
    font: inherit;
    transition: 150ms ease;
}

/* Hover: darken to text color */
form button:hover{
    background-color: var(--text-color);
}

/* Focus: darken to text color, remove default outline */
form button:focus{
    outline: none;
    background-color: var(--text-color);
}

/* =============================================================================
   LINK STYLES
   ============================================================================= */
/* Clean links with accent color, underline on hover */
a{
    text-decoration: none;
    color: var(--accent-color);
}

a:hover{
    text-decoration: underline;
}

/* =============================================================================
   RESPONSIVE DESIGN - TABLET/MOBILE
   ============================================================================= */
/* 
 * Below 1100px: center wrapper and remove asymmetric border radius
 * This creates a more centered card appearance on smaller screens
 */
@media(max-width: 1100px){
    .wrapper{
        width: min(600px, 100%);
        border-radius: 0;         /* Remove rounded corners */
    }
}

/* =============================================================================
   TOAST NOTIFICATION STYLES
   ============================================================================= */
/* 
 * Toast notifications appear above the form to display error messages
 * Uses CSS animation for smooth appearance
 * 
 * States:
 * - .toast-hidden: Element hidden (display: none)
 * - .toast-visible: Element visible with error styling
 */

/* Hidden state - completely removed from layout */
.toast-hidden {
    display: none;
}

/* Visible state - red error styling with fade-in animation */
.toast-visible {
    display: block;
    background-color: #f8d7da;    /* Soft red background */
    color: #721c24;               /* Dark red text for contrast */
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;    /* Slightly darker red border */
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    animation: fadeIn 0.3s;       /* Smooth appearance animation */
}

/* Fade-in animation for toast appearance */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   ROLE SELECTION STYLES (Used by choose_role.html)
   ============================================================================= */
/* 
 * These styles create the role selection UI where users can choose
 * their role (Parent, Staff, Admin) after logging in.
 * 
 * Components:
 * - .role-options: Container for role selection
 * - .role-grid: CSS Grid layout for role cards
 * - .role-card: Individual role button
 * - .role-name: Text label inside role card
 */

/* Container for role options section */
.role-options {
    width: 100%;
    justify-content: center;
}

/* Responsive grid layout for role cards */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

/* Individual role selection card/button */
.role-card {
    border: 2px solid var(--role-btn-border);
    background: var(--role-btn-bg);
    color: var(--text-color);
    border-radius: 12px;
    padding: 0.9em 1.1em;
    font: inherit;
    cursor: pointer;
    transition: background-color 120ms ease, 
                border-color 120ms ease, 
                color 120ms ease, 
                box-shadow 120ms ease;
    width: 100%;
    box-sizing: border-box;
}

/* Role card hover: subtle highlight */
.role-card:hover {
    background: var(--role-btn-hover);
    border-color: var(--accent-color);
}

/* Role card focus: border highlight, no default outline */
.role-card:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Active/selected role card: inverted colors with shadow */
.role-card.active {
    background: var(--role-btn-active);
    color: var(--role-btn-active-text);
    border-color: var(--role-btn-active);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* Role name text inside card */
.role-name {
    display: block;
    font-weight: 700;
    letter-spacing: 0.02em;       /* Slight letter spacing for readability */
}