/* Modern Authentication Styles with EssayIpro Branding */

:root {
    --primary-color: #dc143c;
    --primary-crimson: #dc143c;
    --primary-light: #ff4757;
    --primary-dark: #b71c1c;
    --secondary-color: #2c3e50;
    --accent-color: #f39c12;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #bdc3c7;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #ecf0f1;
    --border-color: #e1e8ed;
    --border-focus: #dc143c;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.2);
    --gradient-primary: linear-gradient(135deg, #dc143c 0%, #ff4757 100%);
    --gradient-secondary: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.floating-shapes {
    position: relative;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: var(--gradient-primary);
    opacity: 0.1;
    animation: float 20s infinite linear;
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

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

.shape-3 {
    width: 60px;
    height: 60px;
    top: 80%;
    left: 20%;
    animation-delay: -10s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 30%;
    animation-delay: -15s;
}

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

/* Main Container */
.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - 140px); /* Account for header and footer */
    position: relative;
    margin-top: 70px; /* Account for fixed header */
    overflow: hidden; /* Prevent content from extending beyond boundaries */
}

/* Left Side - Branding */
.auth-branding {
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.auth-branding::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.branding-content {
    text-align: center;
    color: white;
    z-index: 1;
    position: relative;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.brand-logo {
    height: 80px;
    width: auto;
    filter: brightness(0) invert(1);
}

.brand-name {
    font-size: 48px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.brand-tagline h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.brand-tagline p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.brand-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 40px;
}

.stat-item {
    text-align: center;
}

.auth-branding .stat-number {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: white !important;
}

.auth-branding .stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white !important;
}

/* Right Side - Forms */
.auth-forms {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: var(--bg-primary);
}

.forms-container {
    width: 100%;
    max-width: 500px;
    padding: 0 10px; /* Add padding to prevent buttons from touching edges */
}

/* Role Selection */
.role-selection {
    text-align: center;
}

.role-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.role-header p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.role-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.role-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: var(--transition);
}

.role-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.role-card:hover::before {
    transform: scaleX(1);
}

.role-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.05) 0%, rgba(255, 71, 87, 0.05) 100%);
}

.role-card.selected::before {
    transform: scaleX(1);
}

.role-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
}

.role-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.role-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.role-card ul {
    list-style: none;
    text-align: left;
}

.role-card li {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Authentication Forms */
.auth-forms-wrapper {
    animation: slideIn 0.5s ease-out;
}

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

.auth-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 4px;
    margin-bottom: 32px;
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: calc(var(--border-radius) - 4px);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

.auth-form {
    display: none;
    overflow: hidden; /* Prevent buttons from extending beyond form boundaries */
}

.auth-form.active {
    display: block;
}

.form-header {
    text-align: center;
    margin-bottom: 32px;
}

.form-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

.form-header span {
    color: var(--primary-color);
    font-weight: 600;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.password-input {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.password-strength::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--error-color);
    transition: var(--transition);
}

.password-strength.weak::after {
    width: 25%;
    background: var(--error-color);
}

.password-strength.fair::after {
    width: 50%;
    background: var(--warning-color);
}

.password-strength.good::after {
    width: 75%;
    background: var(--accent-color);
}

.password-strength.strong::after {
    width: 100%;
    background: var(--success-color);
}

.form-help {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    display: block;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-password:hover {
    color: var(--primary-dark);
}

.link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-back {
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-back:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-google {
    width: 100%;
    padding: 16px 24px;
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.btn-google:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

/* Social Login */
.social-login {
    margin-top: 24px;
}

.divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: var(--bg-primary);
    padding: 0 16px;
    color: var(--text-light);
    font-size: 14px;
    position: relative;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-heavy);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.toast.success {
    border-left: 4px solid var(--success-color);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.toast.error {
    border-left: 4px solid var(--error-color);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.1) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-message {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .auth-container {
        grid-template-columns: 1fr;
        margin-top: 60px;
        min-height: calc(100vh - 120px);
    }
    
    .auth-branding {
        padding: 40px 20px;
        min-height: 40vh;
    }
    
    .brand-name {
        font-size: 36px;
    }
    
    .brand-tagline h2 {
        font-size: 24px;
    }
    
    .brand-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .auth-branding .stat-number {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .auth-container {
        margin-top: 50px;
        min-height: calc(100vh - 100px);
    }
    
    .auth-forms {
        padding: 40px 20px;
    }
    
    .role-options {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .role-card {
        padding: 24px 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .brand-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .logo-section {
        flex-direction: column;
        gap: 12px;
    }
    
    .brand-logo {
        height: 60px;
    }
    
    .brand-name {
        font-size: 32px;
    }
    
    .toast {
        min-width: 280px;
        margin: 0 20px 12px 0;
    }
}

@media (max-width: 480px) {
    .auth-branding {
        padding: 30px 16px;
    }
    
    .auth-forms {
        padding: 30px 16px;
    }
    
    .forms-container {
        max-width: 100%;
    }
    
    .role-card {
        padding: 20px 12px;
    }
    
    .role-icon {
        width: 60px;
        height: 60px;
    }
    
    .form-group input {
        padding: 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .btn-primary,
    .btn-google {
        padding: 14px 20px;
    }
}

/* Email Verification Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-heavy);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 0 24px 24px;
}

.verification-info {
    text-align: center;
    margin-bottom: 32px;
}

.verification-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
}

.verification-message {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.verification-message strong {
    color: var(--text-primary);
    font-weight: 600;
}

.verification-instruction {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 0;
}

.verification-form {
    margin-bottom: 24px;
}

.verification-code-input {
    margin-bottom: 24px;
}

.verification-code-input input {
    width: 100%;
    padding: 16px 20px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: 'Courier New', monospace;
}

.verification-code-input input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.verification-code-input input::placeholder {
    color: var(--text-light);
    letter-spacing: 8px;
}

.code-input-help {
    text-align: center;
    margin-top: 8px;
}

.code-input-help span {
    font-size: 12px;
    color: var(--text-light);
}

.verification-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.verification-actions .btn-secondary {
    flex: 1;
    max-width: 140px;
}

.verification-actions .btn-primary {
    flex: 1;
    max-width: 140px;
}

.verification-timer {
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-top: 16px;
}

.verification-timer span {
    font-size: 14px;
    color: var(--text-secondary);
}

#timer {
    font-weight: 600;
    color: var(--primary-color);
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 20px 20px 0;
    }
    
    .modal-body {
        padding: 0 20px 20px;
    }
    
    .verification-icon {
        width: 60px;
        height: 60px;
    }
    
    .verification-code-input input {
        font-size: 20px;
        letter-spacing: 6px;
        padding: 14px 16px;
    }
    
    .verification-actions {
        flex-direction: column;
    }
    
    .verification-actions .btn-secondary,
    .verification-actions .btn-primary {
        max-width: none;
    }
}
