:root {
    --primary: #FF0000;
    --primary-dark: #cc0000;
    --text-main: #333333;
    --text-muted: #777777;
    --bg-white: #ffffff;
    --bg-light: #f9f9f9;
    --border-color: #e0e0e0;
    --input-border: #ff9999;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    height: 100vh;
    height: 100dvh; /* For stable mobile browser viewport */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden; /* Prevent page-level scroll entirely */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

/* Main Container */
.container {
    display: flex;
    width: 100%;
    max-width: 900px;
    height: 600px;
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: visible; /* Kept visible for the triangle pseudo-element layout on mobile */
    position: relative;
}

/* Left Brand Panel */
.brand-panel {
    flex: 1;
    background: var(--primary);
    color: var(--bg-white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    border-radius: 20px 0 0 20px;
    z-index: 2;
}

.brand-content {
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    width: 70px;
    height: 70px;
    background: var(--bg-white);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    margin-bottom: 0.8rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.welcome-heading {
    font-size: 2.8rem;
    font-weight: 700; 
    margin-bottom: 0.2rem;
}

.welcome-sub {
    font-size: 1.8rem; 
    font-weight: 500; 
    margin-bottom: 0.5rem; 
    letter-spacing: 2px;
}

.welcome-desc {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1.5;
    position: absolute;
    bottom: 30px;
    left: 40px;
    right: 40px;
}

/* Right Form Panel */
.form-panel {
    flex: 1.3;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: var(--bg-white);
    position: relative;
    border-radius: 0 20px 20px 0;
}

/* Custom Speech Bubble Triangle Effect for Desktop */
.form-panel::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -18px; /* Overlaps red panel */
    transform: translateY(-50%);
    border-width: 18px 18px 18px 0;
    border-style: solid;
    border-color: transparent var(--bg-white) transparent transparent;
    z-index: 10;
}

.form-container {
    width: 100%;
    max-width: 340px;
    max-height: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-right: 5px;
}
.form-container::-webkit-scrollbar { width: 4px; }
.form-container::-webkit-scrollbar-thumb { background: var(--input-border); border-radius: 4px; }

.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.form-header h2 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Role Selector */
.role-selector {
    display: flex;
    background: var(--bg-white);
    border: 1px solid var(--primary);
    border-radius: 30px;
    padding: 4px;
    margin-bottom: 1.2rem;
    position: relative;
}

.role-selector input[type="radio"] {
    display: none;
}

.role-selector label {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    border-radius: 25px;
    transition: all 0.3s ease;
}

.role-selector input[type="radio"]:checked + label {
    background: var(--primary);
    color: var(--bg-white);
}

/* Input Fields Styles (Following the image styling closely) */
.input-group {
    margin-bottom: 0.8rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: border-color 0.3s ease;
    outline: none;
}

.input-group input:focus, .input-group textarea:focus {
    border-color: var(--primary);
}

/* Checkbox specific styles */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    font-size: 0.8rem;
}

.remember-me, .terms-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
}

.remember-me input, .terms-checkbox input {
    margin-right: 8px;
    accent-color: var(--primary);
    cursor: pointer;
}

.terms-group {
    margin-bottom: 1.2rem;
    font-size: 0.8rem;
    align-items: center;
}

.forgot-password {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.forgot-password:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Buttons */
.step-buttons {
    display: flex;
    gap: 15px;
    margin-top: 1rem;
    width: 100%;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: #f0f0f0;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--bg-white);
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Divider for alternative login */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 0.8rem 0;
    color: #aaaaaa;
    font-size: 0.75rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider::before {
    margin-right: 0.8em;
}

.divider::after {
    margin-left: 0.8em;
}

/* Google Auth Button */
.btn-google {
    width: 100%;
    padding: 10px;
    background: var(--bg-white);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.btn-google img {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

.btn-google:hover {
    background: var(--bg-light);
}

/* Quick Swap Auth Mode */
.auth-switch {
    text-align: center;
    margin-top: 1.2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
}

.auth-switch a::before {
    content: '\2192'; /* Right arrow */
    margin-right: 4px;
    font-size: 1.1rem;
}

.auth-switch a:hover {
    text-decoration: underline;
}


/* Fully Responsive Design tailored to Mobile Fixed View */
@media screen and (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        flex-direction: column;
        height: 100dvh; /* Exact viewport height */
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden; /* Important for fixity */
    }
    
    .brand-panel {
        flex: none;
        padding: 1.5rem 1rem 3rem 1rem; /* Compact header */
        height: auto;
        border-radius: 0 0 20px 20px;
        z-index: 10;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .welcome-heading {
        font-size: 2rem;
        margin-bottom: 0;
    }

    .welcome-sub {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    .welcome-desc {
        display: none; /* Removed for stable scrolling elimination */
    }

    /* Change arrow orientation for mobile display */
    .form-panel::before {
        top: -15px; /* Points UP overlapping Red */
        left: 50%;
        transform: translateX(-50%);
        border-width: 0 15px 15px 15px;
        border-color: transparent transparent var(--bg-white) transparent;
        z-index: 20;
    }
    
    .form-panel {
        flex: 1; /* Take exact rest of the screen */
        padding: 2rem 1.5rem 1rem 1.5rem;
        border-radius: 20px 20px 0 0;
        margin-top: -20px; /* Slight overlap for smoothness */
        align-items: flex-start;
        z-index: 5;
        overflow: hidden; /* Bound context */
        display: flex;
        flex-direction: column;
    }

    .form-container {
        flex: 1; /* Take the whole inside space */
        max-height: 100%; 
        width: 100%;
        padding-right: 0;
        overflow-y: auto; /* Fallback inner scroll if needed on tiny screens, otherwise it just fits */
        /* Hiding scrollbar logic for perfect cleanness on mobile */
        scrollbar-width: none; 
    }
    
    .form-container::-webkit-scrollbar { 
        display: none; 
    }

    /* Optimize internal spacing for better mobile fitment */
    .form-header { margin-bottom: 1rem; }
    .form-header h2 { font-size: 1.5rem; }
    .form-header p { font-size: 0.75rem; }
    .input-group label { font-size: 0.7rem; margin-bottom: 0.1rem; }
    .input-group input, .input-group textarea { padding: 8px 12px; font-size: 0.8rem; }
    .btn-primary, .btn-secondary, .btn-google { padding: 10px; font-size: 0.85rem; margin-bottom: 0.2rem;}
    .step-buttons { margin-top: 0.5rem; }
    .role-selector { margin-bottom: 1rem; padding: 2px;}
    .role-selector label { padding: 6px 0; font-size: 0.8rem;}
    .auth-switch { margin-top: 0.8rem; font-size: 0.8rem;}
}
