/**
 * Sirati Company Portal - Authentication Styles
 * Extends student-auth with company-specific branding
 */

/* Import base student auth styles by including them inline for company portal */
/* Override brand-panel with corporate style */

:root {
    --primary: #0f172a;
    --primary-dark: #020617;
    --accent: #0074d9;
    --accent-hover: #0063b8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
    
    /* Company-specific */
    --company-primary: #0f172a;
    --company-gradient-start: #0f172a;
    --company-gradient-end: #1e3a5f;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fff;
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   50/50 Split Layout
   ========================================== */

.split-layout {
    display: flex;
    min-height: 100vh;
}

/* Form Panel - Left Side */
.form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: #fff;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.form-panel::-webkit-scrollbar {
    display: none;
}

@media (min-width: 1024px) {
    .form-panel {
        flex: 0 0 50%;
        padding: 32px 48px;
    }
}

@media (min-width: 1280px) {
    .form-panel {
        padding: 40px 64px;
    }
}

.form-container {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-container.narrow {
    max-width: 400px;
}

/* Brand Panel - Right Side with Animated Background */
.brand-panel {
    display: none;
    flex: 0 0 50%;
    position: relative;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0e4d71 100%);
    overflow: hidden;
}

@media (min-width: 1024px) {
    .brand-panel {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Animation styles are now in /assets/css/animated-bg.css */

/* Legacy image-based brand panel (fallback) */
.brand-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.brand-content {
    position: absolute;
    bottom: 60px;
    left: 60px;
    right: 60px;
    z-index: 2;
    color: #fff;
}

.brand-logo {
    height: 48px;
    width: auto;
    margin-bottom: 24px;
    filter: brightness(0) invert(1);
}

.brand-title {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    max-width: 400px;
}

/* Top Header */
.form-top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
}

.form-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.portal-badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--company-primary);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.08) 0%, rgba(15, 23, 42, 0.04) 100%);
    padding: 6px 12px;
    border-radius: 20px;
    letter-spacing: 0.02em;
    border: 1px solid rgba(15, 23, 42, 0.12);
    white-space: nowrap;
}

/* Form Header */
.form-header {
    margin-bottom: 16px;
}

.form-header.centered {
    text-align: center;
}

.form-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

@media (min-width: 640px) {
    .form-header h2 {
        font-size: 26px;
    }
}

.form-header p {
    color: var(--gray-500);
    font-size: 14px;
}

/* Invite Box */
.invite-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.invite-box i {
    color: #0369a1;
    font-size: 18px;
}

.invite-box span {
    font-size: 14px;
    color: #0c4a6e;
}

.invite-box strong {
    font-weight: 600;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

/* Input Fields */
.field {
    position: relative;
}

.field-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-900);
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: var(--transition);
    outline: none;
}

@media (min-width: 640px) {
    .field-input {
        height: 42px;
        font-size: 14px;
    }
}

.field-input::placeholder {
    color: var(--gray-400);
}

.field-input:hover {
    border-color: var(--gray-400);
}

.field-input:focus {
    border-color: var(--company-primary);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.field-input.has-action {
    padding-right: 38px;
}

.field-action {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.field-action:hover {
    color: var(--gray-600);
}

/* Textarea */
textarea.field-input {
    height: auto;
    min-height: 80px;
    padding: 12px;
    resize: vertical;
}

/* Select */
select.field-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    cursor: pointer;
}

/* Password Requirements */
.password-requirements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 16px;
    margin-top: 6px;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--gray-400);
    transition: var(--transition);
    white-space: nowrap;
}

.requirement i {
    font-size: 6px;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-300);
    border-radius: 50%;
    flex-shrink: 0;
}

.requirement.met {
    color: var(--success);
}

.requirement.met i {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* Buttons */
.btn {
    width: 100%;
    height: 40px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    margin-top: 6px;
}

@media (min-width: 640px) {
    .btn {
        height: 42px;
        font-size: 14px;
    }
}

.btn-primary {
    background: var(--company-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #1e293b;
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 16px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
    line-height: 1.4;
    position: relative;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-label .checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.checkbox-label .checkmark svg {
    width: 10px;
    height: 10px;
    stroke: #fff;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

.checkbox-label:hover .checkmark {
    border-color: var(--company-primary);
}

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

.checkbox-label input[type="checkbox"]:checked + .checkmark svg {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* Remember Me */
.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
    position: relative;
    user-select: none;
}

.remember-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.remember-label .checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.remember-label .checkmark svg {
    width: 10px;
    height: 10px;
    stroke: #fff;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

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

.remember-label input[type="checkbox"]:checked + .checkmark svg {
    opacity: 1;
    transform: scale(1);
}

.forgot-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

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

/* Form Footer */
.form-footer {
    margin-top: 14px;
    text-align: center;
    font-size: 13px;
    color: var(--gray-500);
}

.form-footer a {
    color: var(--gray-900);
    font-weight: 600;
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast-success {
    background: var(--success);
    color: #fff;
}

.toast-error {
    background: var(--error);
    color: #fff;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px;
    margin-left: 8px;
    opacity: 0.8;
}

.toast-close:hover { opacity: 1; }

/* OTP Verification */
.otp-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 32px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    font-family: inherit;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: #fff;
    transition: var(--transition);
    color: var(--gray-900);
    outline: none;
}

.otp-input:focus {
    border-color: var(--company-primary);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.otp-input.filled {
    border-color: var(--gray-900);
    background: var(--gray-50);
}

.verification-box {
    text-align: center;
    padding: 16px 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.verification-box p {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 4px;
}

.verification-box strong {
    color: var(--gray-900);
    font-size: 15px;
}

.resend-section {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.resend-section p {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 12px;
}

.resend-btn {
    background: none;
    border: none;
    color: var(--gray-900);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.resend-btn:hover { text-decoration: underline; }
.resend-btn:disabled {
    color: var(--gray-400);
    cursor: not-allowed;
    text-decoration: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-500);
    font-size: 14px;
    text-decoration: none;
    margin-top: 16px;
}

.back-link:hover { color: var(--gray-900); }

.verification-icon {
    width: 64px;
    height: 64px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.verification-icon i {
    font-size: 28px;
    color: var(--success);
}

/* Invalid Invite */
.invalid-invite {
    text-align: center;
    padding: 60px 20px;
}

.invalid-invite-icon {
    width: 80px;
    height: 80px;
    background: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.invalid-invite-icon i {
    font-size: 36px;
    color: var(--error);
}

.invalid-invite h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.invalid-invite p {
    color: var(--gray-500);
    font-size: 15px;
    line-height: 1.6;
    max-width: 360px;
    margin: 0 auto;
}

/* Phone Input */
.phone-field .iti {
    width: 100%;
}

.phone-field .iti__tel-input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 85px;
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-900);
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: var(--transition);
    outline: none;
}

@media (min-width: 640px) {
    .phone-field .iti__tel-input {
        height: 42px;
        font-size: 14px;
    }
}

.phone-field .iti__tel-input:focus {
    border-color: var(--company-primary);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

/* Responsive */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .password-requirements {
        grid-template-columns: 1fr;
    }
}

/* ========================================== */
/* Custom Select Dropdowns                    */
/* ========================================== */

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-900);
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

@media (min-width: 640px) {
    .custom-select-trigger {
        height: 42px;
        font-size: 14px;
    }
}

.custom-select-trigger:focus,
.custom-select-trigger:hover {
    border-color: var(--company-primary);
}

.custom-select-wrapper.is-open .custom-select-trigger {
    border-color: var(--company-primary);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.custom-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-value.placeholder {
    color: var(--gray-400);
}

.custom-select-chevron {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.custom-select-wrapper.is-open .custom-select-chevron {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.15);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.custom-select-wrapper.is-open .custom-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s ease;
}

@media (min-width: 640px) {
    .custom-select-option {
        font-size: 14px;
    }
}

.custom-select-option:hover {
    background: var(--gray-50);
}

.custom-select-option.selected {
    background: rgba(15, 23, 42, 0.05);
    color: var(--company-primary);
    font-weight: 500;
}

.custom-select-option:first-child {
    color: var(--gray-400);
}

/* Checkmark icon in select options */
.custom-select-option .check-icon {
    width: 16px;
    height: 16px;
    margin-right: 10px;
    flex-shrink: 0;
    opacity: 0;
    color: var(--company-primary);
    transition: opacity 0.15s ease;
}

.custom-select-option.selected .check-icon {
    opacity: 1;
}

/* Dropdown scrollbar styling */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: var(--gray-50);
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
