/* ============================================================
   Course Central – Auth (Login / Sign Up) Page Styles
   ============================================================ */

/* ── Reset for standalone page ──────────────────────────────── */
body.cc-auth-page {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
}
body.cc-auth-page #bcm-header,
body.cc-auth-page #bcm-footer,
body.cc-auth-page .bcm-main-content > *:not(.cc-auth-wrap),
body.cc-auth-page .bcm-mobile-nav,
body.cc-auth-page #bcm-overlay-bg {
    display: none !important;
}
body.cc-auth-page .bcm-main-content {
    padding: 0 !important;
    margin: 0 !important;
}

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    --ca-p:       #4f46e5;
    --ca-ph:      #4338ca;
    --ca-bg:      #ffffff;
    --ca-surface: #f8fafc;
    --ca-border:  #e2e8f0;
    --ca-text:    #1e293b;
    --ca-muted:   #64748b;
    --ca-error:   #ef4444;
    --ca-success: #16a34a;
    --ca-radius:  12px;
}

/* ── Layout Wrapper ─────────────────────────────────────────── */
.cc-auth-wrap {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ── Left Cover (60%) ───────────────────────────────────────── */
.cc-auth-cover {
    flex: 0 0 60%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4f46e5 70%, #06b6d4 100%);
}
.cc-auth-cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cc-auth-cover-default {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 60px;
    color: #fff;
    text-align: center;
}
.cc-auth-cover-circles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.cc-auth-cover-circles span {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    animation: cc-float 8s ease-in-out infinite;
}
.cc-auth-cover-circles span:nth-child(1) {
    width: 420px; height: 420px;
    top: -140px; left: -100px;
    animation-delay: 0s;
}
.cc-auth-cover-circles span:nth-child(2) {
    width: 280px; height: 280px;
    bottom: 40px; right: -80px;
    animation-delay: 3s;
}
.cc-auth-cover-circles span:nth-child(3) {
    width: 180px; height: 180px;
    top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 5s;
}
@keyframes cc-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-20px) scale(1.04); }
}
.cc-auth-cover-logo { position: relative; z-index: 1; }
.cc-auth-cover-logo img { max-height: 64px; max-width: 220px; }
.cc-auth-site-name {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}
.cc-auth-cover-tagline {
    position: relative;
    z-index: 1;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.82);
    max-width: 340px;
    line-height: 1.6;
    margin: 0;
}

/* ── Right Form Panel (40%) ─────────────────────────────────── */
.cc-auth-form-panel {
    flex: 0 0 40%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ca-bg);
    min-height: 100vh;
    padding: 60px 40px 60px;
    overflow-y: auto;
}

/* ── Close Button ───────────────────────────────────────────── */
.cc-auth-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--ca-surface);
    border: 1px solid var(--ca-border);
    color: var(--ca-muted);
    font-size: 14px;
    text-decoration: none;
    transition: background .15s, color .15s;
    z-index: 10;
}
.cc-auth-close:hover { background: #fee2e2; color: var(--ca-error); border-color: #fca5a5; }

/* ── Form Inner ─────────────────────────────────────────────── */
.cc-auth-form-inner {
    width: 100%;
    max-width: 380px;
    position: relative;
}

/* ── Screen System (state machine) ─────────────────────────── */
.cc-auth-screen {
    display: none;
    animation: cc-auth-fadein .22s ease;
}
.cc-auth-screen.cc-auth-screen-active { display: block; }
@keyframes cc-auth-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Back Button ────────────────────────────────────────────── */
.cc-auth-back-btn {
    background: none;
    border: none;
    color: var(--ca-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color .15s;
}
.cc-auth-back-btn:hover { color: var(--ca-p); }

/* ── Title / Subtitle ───────────────────────────────────────── */
.cc-auth-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--ca-text);
    margin: 0 0 6px;
    letter-spacing: -0.5px;
    line-height: 1.25;
}
.cc-auth-subtitle {
    font-size: 14px;
    color: var(--ca-muted);
    margin: 0 0 28px;
}

/* ── Field Group ────────────────────────────────────────────── */
.cc-auth-field-group {
    margin-bottom: 16px;
}
.cc-auth-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ca-text);
    margin-bottom: 6px;
}

/* ── Input ──────────────────────────────────────────────────── */
.cc-auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.cc-auth-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--ca-border);
    border-radius: var(--ca-radius);
    font-size: 14px;
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
    background: #ffffff !important;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
/* Fix browser autofill color override */
.cc-auth-input:-webkit-autofill,
.cc-auth-input:-webkit-autofill:hover,
.cc-auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #1e293b !important;
    -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
    box-shadow: 0 0 0px 1000px #ffffff inset !important;
}
.cc-auth-input:focus {
    border-color: var(--ca-p);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.cc-auth-input.cc-input-error {
    border-color: var(--ca-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.cc-auth-input.cc-input-ok {
    border-color: var(--ca-success);
}
.cc-auth-input-otp {
    letter-spacing: 8px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
}

/* ── Eye Toggle ─────────────────────────────────────────────── */
.cc-auth-eye-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ca-muted);
    padding: 0;
    display: flex;
    align-items: center;
    transition: color .15s;
}
.cc-auth-input-wrap .cc-auth-input { padding-right: 42px; }
.cc-auth-eye-btn:hover { color: var(--ca-p); }

/* ── Field status icons ─────────────────────────────────────── */
.cc-auth-field-status {
    position: absolute;
    right: 12px;
    font-size: 16px;
    pointer-events: none;
}
.cc-auth-field-hint {
    display: block;
    font-size: 11.5px;
    margin-top: 4px;
}
.cc-auth-field-hint.cc-hint-error { color: var(--ca-error); }
.cc-auth-field-hint.cc-hint-ok    { color: var(--ca-success); }

/* ── Feedback Messages ──────────────────────────────────────── */
.cc-auth-feedback {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
}
.cc-auth-feedback-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: var(--ca-error);
}
.cc-auth-feedback-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: var(--ca-success);
}

/* ── OTP Note ───────────────────────────────────────────────── */
.cc-auth-otp-note {
    font-size: 12px;
    color: var(--ca-muted);
    margin: 8px 0 0;
    line-height: 1.5;
}

/* ── Primary Button ─────────────────────────────────────────── */
.cc-auth-btn-primary {
    width: 100%;
    height: 46px;
    background: var(--ca-p);
    color: #fff;
    border: none;
    border-radius: var(--ca-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    position: relative;
}
.cc-auth-btn-primary:hover:not(:disabled) { background: var(--ca-ph); }
.cc-auth-btn-primary:active:not(:disabled) { transform: scale(.98); }
.cc-auth-btn-primary:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* ── Outline Button ─────────────────────────────────────────── */
.cc-auth-btn-outline {
    width: 100%;
    height: 44px;
    background: transparent;
    color: var(--ca-p);
    border: 1.5px solid var(--ca-p);
    border-radius: var(--ca-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cc-auth-btn-outline:hover { background: rgba(79,70,229,.06); }

/* ── OTP Inline Row ─────────────────────────────────────────── */
.cc-auth-otp-inline {
    display: flex;
    gap: 8px;
}
.cc-auth-otp-inline .cc-auth-input { flex: 1; }
.cc-reg-otp-verify-btn { flex: 0 0 auto; width: auto; padding: 0 18px; height: 44px; font-size: 13px; }

/* ── Spinner ────────────────────────────────────────────────── */
.cc-auth-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cc-spin .7s linear infinite;
}
.cc-auth-loading .cc-auth-btn-text { display: none; }
.cc-auth-loading .cc-auth-spinner  { display: inline-block; }
@keyframes cc-spin {
    to { transform: rotate(360deg); }
}

/* ── Forgot / Link Buttons ──────────────────────────────────── */
.cc-auth-link-btn {
    background: none;
    border: none;
    color: var(--ca-p);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 0 0;
    display: block;
    width: 100%;
    text-align: center;
    transition: color .15s;
}
.cc-auth-link-btn:hover { color: var(--ca-ph); text-decoration: underline; }

/* ── Divider ────────────────────────────────────────────────── */
.cc-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--ca-muted);
    font-size: 12px;
}
.cc-auth-divider::before,
.cc-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ca-border);
}

/* ── Social Buttons ─────────────────────────────────────────── */
.cc-auth-social-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cc-auth-social-btn {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1.5px solid var(--ca-border);
    border-radius: var(--ca-radius);
    background: #fff;
    color: var(--ca-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.cc-auth-social-btn:hover { border-color: #94a3b8; background: #f8fafc; }

/* ── Switch Text ────────────────────────────────────────────── */
.cc-auth-switch-text {
    text-align: center;
    font-size: 13px;
    color: var(--ca-muted);
    margin-top: 22px;
}
.cc-auth-switch-link {
    color: var(--ca-p);
    font-weight: 600;
    text-decoration: none;
}
.cc-auth-switch-link:hover { text-decoration: underline; }

/* ── Success Icon ───────────────────────────────────────────── */
.cc-auth-success-icon {
    width: 64px;
    height: 64px;
    background: #dcfce7;
    border: 2px solid #86efac;
    color: var(--ca-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto 24px;
}

/* ── Send OTP wrap ──────────────────────────────────────────── */
.cc-reg-send-otp-wrap {
    font-size: 13.5px;
}

/* ── Light Mode (explicit) ──────────────────────────────────── */
body.cc-auth-page {
    --ca-bg:      #ffffff;
    --ca-surface: #f8fafc;
    --ca-border:  #e2e8f0;
    --ca-text:    #1e293b;
    --ca-muted:   #64748b;
}
/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] body.cc-auth-page {
    --ca-bg:      #0f172a;
    --ca-surface: #1e293b;
    --ca-border:  #334155;
    --ca-text:    #e2e8f0;
    --ca-muted:   #94a3b8;
}
[data-theme="dark"] .cc-auth-form-panel { background: var(--ca-bg); }
[data-theme="dark"] .cc-auth-input {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    border-color: #334155;
}
[data-theme="dark"] .cc-auth-input:-webkit-autofill,
[data-theme="dark"] .cc-auth-input:-webkit-autofill:hover,
[data-theme="dark"] .cc-auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e2e8f0 !important;
    -webkit-box-shadow: 0 0 0px 1000px #1e293b inset !important;
    box-shadow: 0 0 0px 1000px #1e293b inset !important;
}
[data-theme="dark"] .cc-auth-input:focus { border-color: var(--ca-p); }
[data-theme="dark"] .cc-auth-social-btn { background: #1e293b; color: #e2e8f0; border-color: #334155; }
[data-theme="dark"] .cc-auth-social-btn:hover { background: #243557; }
[data-theme="dark"] .cc-auth-close { background: #1e293b; border-color: #334155; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cc-auth-cover { flex: 0 0 45%; }
    .cc-auth-form-panel { flex: 0 0 55%; padding: 50px 30px; }
}
@media (max-width: 640px) {
    .cc-auth-cover { display: none; }
    .cc-auth-form-panel { flex: 1 1 100%; padding: 40px 24px; }
    .cc-auth-form-inner { max-width: 100%; }
}

/* ============================================================
   BCM THEME COMPATIBILITY — Metallic Design Overrides
   ============================================================ */

/* — Sync primary colour with BCM token — */
:root {
    --ca-p:      var(--bcm-primary,  #3b82f6);
    --ca-ph:     #2563eb;
    --ca-radius: 50px;   /* pill-shaped inputs/buttons */
}

/* — Form panel: metallic surface — */
.cc-auth-form-panel {
    background:  var(--bcm-metal-bg, linear-gradient(145deg, #e0e0e0 0%, #fff 50%, #d1d1d1 100%));
    border-left: var(--bcm-metal-border, 1px solid #c0c0c0);
}

/* — Primary submit button: pill + hard shadow — */
.cc-auth-btn-primary {
    border-radius: var(--bcm-radius-pill, 60px);
    background:    var(--bcm-primary, #3b82f6);
    box-shadow:    var(--bcm-shadow,   6px 6px 0 #000);
    transition:    background .15s, box-shadow .15s, transform .15s;
}
.cc-auth-btn-primary:hover:not(:disabled) {
    background:  #2563eb;
    transform:   translate(-2px, -2px);
    box-shadow:  8px 8px 0 #000;
}

/* — Outline button: pill shape — */
.cc-auth-btn-outline {
    border-radius: var(--bcm-radius-pill, 60px);
    border-color:  var(--bcm-primary, #3b82f6);
    box-shadow:    3px 3px 0 var(--bcm-shadow-color, #000);
}
.cc-auth-btn-outline:hover { background: rgba(59,130,246,.07); }

/* — Social buttons: metallic card style — */
.cc-auth-social-btn {
    background:    var(--bcm-metal-bg, linear-gradient(145deg, #e0e0e0 0%, #fff 50%, #d1d1d1 100%));
    border:        var(--bcm-metal-border, 1px solid #c0c0c0);
    border-radius: 16px;
    box-shadow:    3px 3px 0 var(--bcm-shadow-color, #000);
    transition:    transform .15s, box-shadow .15s;
    color:         #1e293b; /* explicit dark text in day mode */
}
.cc-auth-social-btn:hover {
    background:  linear-gradient(145deg, #d8d8d8 0%, #f5f5f5 50%, #cccccc 100%);
    transform:   translate(-2px, -2px);
    box-shadow:  5px 5px 0 var(--bcm-shadow-color, #000);
}

/* — Dark-mode overrides for the new styles — */
[data-theme="dark"] .cc-auth-form-panel { background: #111111; border-left-color: #333; }
[data-theme="dark"] .cc-auth-social-btn {
    background: var(--bcm-metal-dark, linear-gradient(145deg,#2a2a2a,#444,#1a1a1a));
    border: var(--bcm-metal-dark-border, 1px solid #444);
}
