/* Modern Login Page with Dark Red Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b1b 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
}

.login-container {
    width: 100vw;
    height: 100vh;
    padding: 0;
    margin: 0;
    position: relative;
}

/* Desktop/Tablet Layout */
.desktop-layout {
    display: flex;
    background: white;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    flex-direction: row-reverse;
}

.mobile-layout {
    display: none;
}

/* Welcome Section */
.welcome-section {
    flex: 3;
    background: linear-gradient(135deg, #692929 0%, #7E1F1F 50%, #802828 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 60px;
    overflow: hidden;
    height: 100vh;
}

.welcome-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    max-width: 400px;
}

.welcome-text {
    font-size: 18px;
    font-weight: 300;
    margin-bottom: 20px;
    opacity: 0.9;
}

.brand-logo {
    margin-bottom: 30px;
}

.logo-icon {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
}

.brand-name {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1px;
}

.welcome-description {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 40px;
    opacity: 0.9;
    font-weight: 400;
}

.creator-info {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 300;
}

/* Cloud Shapes */
.cloud-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    animation: float 6s ease-in-out infinite;
}

.cloud-1 {
    width: 80px;
    height: 40px;
    top: 20%;
    right: 10%;
    animation-delay: 0s;
}

.cloud-2 {
    width: 120px;
    height: 60px;
    top: 60%;
    right: 5%;
    animation-delay: 2s;
}

.cloud-3 {
    width: 100px;
    height: 50px;
    top: 40%;
    right: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Form Section */
.form-section {
    flex: 1;
    padding: 80px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    height: 100vh;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    /*width: 100px;*/
    height: 100%;
    background: linear-gradient(135deg, #692929 0%, #802828 100%);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    z-index: 1;
}

.form-header {
    position: relative;
    z-index: 2;
    margin-bottom: 40px;
}

.form-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.form-header p {
    color: #6b7280;
    font-size: 16px;
    font-weight: 400;
}

/* Login Role Toggle */
.login-role-toggle {
    margin-bottom: 30px;
}

.login-role-toggle.animating .role-btn {
    transition: all 0.3s ease;
}

.login-role-toggle .btn-group {
    display: flex;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.role-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 0;
    margin: 0;
    cursor: pointer;
}

.role-btn.active {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

.role-btn:not(.active):hover {
    background: #e5e7eb;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.role-btn.active:hover {
    background: linear-gradient(135deg, #B91C1C 0%, #991B1B 100%);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    transform: translateY(-2px);
}

/* Animation for role switch */
.role-btn {
    position: relative;
    overflow: hidden;
}

.role-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.role-btn.active::before {
    left: 100%;
}

.login-form {
    position: relative;
    z-index: 2;
}

/* Form field swap animations (slide to the right) */
.admin-field, .agent-field {
    will-change: transform, opacity;
}

/* Slide out to the right */
@keyframes slideOutToRight {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(24px); opacity: 0; }
}

/* Slide in from left to neutral position */
@keyframes slideInFromLeft {
    from { transform: translateX(-24px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* Utility classes to trigger animations */
.slide-out-right {
    animation: slideOutToRight 0.36s cubic-bezier(.2,.9,.2,1) forwards;
}

.slide-in-right {
    animation: slideInFromLeft 0.42s cubic-bezier(.2,.9,.2,1) forwards;
}

/* Apply small smoothing to shared fields (password & button) */
.form-group, .form-actions {
    will-change: transform, opacity;
}

/* Legacy fade classes kept for backward compatibility */
.admin-field.fade-out, .agent-field.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.admin-field.fade-in, .agent-field.fade-in {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 15px 50px 15px 15px;
    border: none;
    border-bottom: 2px solid #e5e7eb;
    background: transparent;
    font-size: 16px;
    font-weight: 400;
    color: #1a1a1a;
    transition: all 0.3s ease;
    outline: none;
}

.form-control:focus {
    border-bottom-color: #DC2626;
    background: rgba(220, 38, 38, 0.05);
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.form-actions {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 15px 40px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4);
}

.btn-secondary {
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    /* Ensure hover text color stays readable even if Bootstrap defaults differ */
    color: #6b7280;
}

.btn-secondary:focus {
    color: #6b7280;
}

.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: none;
    font-weight: 500;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border-left: 4px solid #dc2626;
}

.text-danger {
    color: #dc2626;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

/* Mobile Layout */
@media (max-width: 768px) {
    .desktop-layout {
        display: none;
    }
    
    .mobile-layout {
        display: flex;
        flex-direction: column;
        height: 100vh;
        width: 100vw;
    }
    
    .login-container {
        padding: 0;
        height: 100vh;
        width: 100vw;
    }
    
    .welcome-card {
        background: linear-gradient(135deg, #DC2626 0%, #B91C1C 50%, #991B1B 100%);
        border-radius: 0;
        padding: 40px 20px;
        margin-bottom: 0;
        position: relative;
        overflow: hidden;
        height: 40vh;
        min-height: 300px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .welcome-content {
        position: relative;
        z-index: 2;
        text-align: center;
        color: white;
        max-width: 100%;
    }
    
    .welcome-text {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .brand-name {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .welcome-description {
        font-size: 12px;
        margin-bottom: 20px;
        line-height: 1.4;
    }
    
    .creator-info {
        font-size: 10px;
    }
    
    .cloud-1 {
        width: 50px;
        height: 25px;
        top: 10%;
        right: 10%;
    }
    
    .cloud-2 {
        width: 60px;
        height: 30px;
        top: 80%;
        right: 5%;
    }
    
    .form-card {
        background: white;
        border-radius: 0;
        padding: 30px 20px;
        box-shadow: none;
        position: relative;
        height: 60vh;
        min-height: 400px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow-y: auto;
    }
    
    .form-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100px;
        height: 15px;
        background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
        border-radius: 0;
    }
    
    .form-header {
        text-align: center;
        margin-bottom: 25px;
        margin-top: 15px;
    }
    
    .form-header h2 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .form-header p {
        font-size: 13px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-control {
        padding: 12px 45px 12px 12px;
        font-size: 14px;
    }
    
    .input-icon {
        right: 12px;
    }
    
    .form-actions {
        justify-content: center;
        margin-top: 25px;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 14px;
        min-width: 160px;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .welcome-card {
        padding: 25px 15px;
        height: 35vh;
        min-height: 250px;
    }
    
    .form-card {
        padding: 25px 15px;
        height: 65vh;
        min-height: 350px;
    }
    
    .brand-name {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .welcome-text {
        font-size: 12px;
    }
    
    .welcome-description {
        font-size: 11px;
        margin-bottom: 15px;
    }
    
    .form-header h2 {
        font-size: 20px;
    }
    
    .form-header p {
        font-size: 12px;
    }
    
    .form-control {
        padding: 10px 40px 10px 10px;
        font-size: 13px;
    }
    
    .input-icon {
        right: 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
        min-width: 140px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .welcome-card {
        height: 30vh;
        min-height: 200px;
        padding: 20px 15px;
    }
    
    .form-card {
        height: 70vh;
        min-height: 300px;
        padding: 20px 15px;
    }
    
    .brand-name {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .welcome-text {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .welcome-description {
        font-size: 10px;
        margin-bottom: 10px;
    }
    
    .form-header h2 {
        font-size: 18px;
        margin-bottom: 5px;
    }
    
    .form-header p {
        font-size: 11px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        padding: 8px 35px 8px 8px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 12px;
        min-width: 120px;
    }
}

/* Animation for page load */
.login-card {
    animation: slideInUp 0.8s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus states for accessibility */
.form-control:focus,
.btn:focus {
    outline: 2px solid #DC2626;
    outline-offset: 2px;
}

/* Loading state for buttons */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #DC2626;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #B91C1C;
}

/* Setup panel animation (slide in/out) */
.setup-panel {
    transform: translateX(24px);
    opacity: 0;
    transition: transform 0.36s cubic-bezier(.2,.9,.2,1), opacity 0.36s ease;
    display: none;
}

.setup-panel.setup-in {
    transform: translateX(0);
    opacity: 1;
    display: block;
}

.setup-panel.setup-out {
    transform: translateX(24px);
    opacity: 0;
}

/* Back button */
.setup-back {
    border: none;
    background: transparent;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.setup-back:hover {
    background: rgba(0,0,0,0.03);
}

/* Move Google's reCAPTCHA badge to the left side to avoid overlapping form controls (important override) */
.grecaptcha-badge {
    right: 500px !important;
    /* move to top so the challenge popup doesn't overlap form fields */
    top: 190px !important;
    bottom: auto !important;
    z-index: 1200 !important;
}

/* Also target potential iframe wrapper used by some recaptcha versions */
iframe[src*="recaptcha"] {
    z-index: 1200 !important;
}

/* On very small screens keep the badge slightly smaller and inset */
@media (max-width: 480px) {
    .grecaptcha-badge {
        left: 8px !important;
        top: 8px !important;
        transform: scale(0.92) !important;
    }
}