/**
 * AuthCraft Pro - Public Styles
 * Premium Glassmorphism + Neumorphism UI
 */

/* ==================== RESET & BASE ==================== */
.authcraft-wrap, .authcraft-wrap * {
    box-sizing: border-box;
}

.authcraft-wrap {
    font-family: var(--ac-font, 'Inter', system-ui, -apple-system, sans-serif);
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    position: relative;
    overflow: hidden;
    color: var(--ac-text-color, #4a5568);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.authcraft-wrap::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 0%, transparent 40%);
    pointer-events: none;
    animation: ac-float-bg 20s ease-in-out infinite;
}

@keyframes ac-float-bg {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, 30px) rotate(5deg); }
}

/* ==================== LAYOUTS ==================== */
.authcraft-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    z-index: 2;
}

.authcraft-side {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

.authcraft-side-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 60px;
}

.authcraft-side-image-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.authcraft-side-image-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.authcraft-side-content {
    position: relative;
    z-index: 2;
    color: #fff;
    max-width: 400px;
}

.authcraft-side-logo {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.authcraft-side-content h2 {
    font-size: 38px;
    font-weight: 800;
    margin: 0 0 12px;
    line-height: 1.15;
    color: #fff;
}

.authcraft-side-content p {
    font-size: 17px;
    line-height: 1.6;
    opacity: 0.95;
    margin: 0;
}

/* Layout: full-screen */
.authcraft-layout-fullscreen .authcraft-side { display: none; }

/* Layout: card */
.authcraft-layout-card .authcraft-main {
    padding: 60px 20px;
}

/* ==================== CARD / GLASSMORPHISM ==================== */
.authcraft-card {
    width: 100%;
    max-width: var(--ac-form-width, 440px);
    padding: var(--ac-form-padding, 40px);
    border-radius: var(--ac-form-radius, 24px);
    background: var(--ac-form-bg, rgba(255,255,255,0.95));
    box-shadow: var(--ac-form-shadow, 0 20px 60px rgba(0,0,0,0.15));
    position: relative;
    animation: ac-card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.authcraft-style-glass {
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.75);
}

.authcraft-style-neumorphic {
    background: #f0f4f8;
    box-shadow:
        12px 12px 30px rgba(174,174,192,0.4),
        -12px -12px 30px rgba(255,255,255,0.95);
    border: none;
}

.authcraft-style-solid {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
}

@keyframes ac-card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== HEADER ==================== */
.authcraft-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.authcraft-brand {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(102,126,234,0.12), rgba(118,75,162,0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ac-brand-pulse 3s ease-in-out infinite;
}

@keyframes ac-brand-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.authcraft-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 8px;
    color: var(--ac-heading-color, #1a202c);
    letter-spacing: -0.5px;
}

.authcraft-subtitle {
    font-size: 15px;
    color: var(--ac-text-color, #718096);
    margin: 0;
    line-height: 1.5;
}

/* ==================== FORM FIELDS / FLOATING LABELS ==================== */
.authcraft-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.authcraft-field {
    position: relative;
}

.authcraft-field input {
    width: 100%;
    height: 56px;
    padding: 18px 18px 6px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    color: var(--ac-input-text, #1a202c);
    background: var(--ac-input-bg, rgba(255,255,255,0.6));
    border: 2px solid var(--ac-input-border, #e2e8f0);
    border-radius: var(--ac-input-radius, 12px);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.authcraft-field.has-icon.icon-left input { padding-left: 48px; }
.authcraft-field.has-icon.icon-right input { padding-right: 48px; }
.authcraft-field.has-toggle input { padding-right: 48px; }
.authcraft-field.has-icon.icon-right.has-toggle input { padding-right: 80px; }

.authcraft-field input:focus {
    border-color: var(--ac-input-focus, #667eea);
    background: rgba(255,255,255,0.95);
    box-shadow: 0 0 0 4px rgba(102,126,234,0.12);
    transform: translateY(-1px);
}

.authcraft-field label {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: #94a3b8;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    background: transparent;
    padding: 0 4px;
}

.authcraft-field.has-icon.icon-left label { left: 48px; }

.authcraft-field input:focus + label,
.authcraft-field input:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%) scale(0.85);
    color: var(--ac-input-focus, #667eea);
    background: var(--ac-form-bg, rgba(255,255,255,0.95));
    font-weight: 600;
}

.authcraft-field-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--ac-icon-color, #667eea);
    transition: color 0.3s ease;
    z-index: 2;
}

.authcraft-field.icon-left .authcraft-field-icon { left: 16px; }
.authcraft-field.icon-right .authcraft-field-icon { right: 16px; }
.authcraft-field.has-toggle.icon-right .authcraft-field-icon { right: 52px; }

.authcraft-field input:focus ~ .authcraft-field-icon {
    color: var(--ac-input-focus, #667eea);
}

.authcraft-field-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ac-input-focus, #667eea), #764ba2);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.authcraft-field input:focus ~ .authcraft-field-line {
    width: 80%;
    left: 10%;
}

/* Password toggle */
.authcraft-pass-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: #94a3b8;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.authcraft-pass-toggle:hover {
    color: var(--ac-icon-hover, #764ba2);
    background: rgba(102,126,234,0.08);
}

.authcraft-pass-toggle .hide { display: none; }
.authcraft-pass-toggle.is-visible .show { display: none; }
.authcraft-pass-toggle.is-visible .hide { display: flex; }

/* ==================== ICON COMMON ==================== */
.authcraft-icon {
    width: var(--ac-icon-size, 20px);
    height: var(--ac-icon-size, 20px);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.authcraft-spinner {
    animation: ac-spin 0.85s linear infinite;
}

@keyframes ac-spin {
    to { transform: rotate(360deg); }
}

/* ==================== ROW: REMEMBER + FORGOT ==================== */
.authcraft-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
}

/* ==================== CHECKBOX ==================== */
.authcraft-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--ac-text-color, #4a5568);
    line-height: 1.4;
}

.authcraft-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.authcraft-check-box {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.authcraft-check-box .authcraft-icon {
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.2s ease;
}

.authcraft-checkbox input:checked + .authcraft-check-box {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
}

.authcraft-checkbox input:checked + .authcraft-check-box .authcraft-icon {
    opacity: 1;
    transform: scale(1);
}

.authcraft-checkbox input:focus-visible + .authcraft-check-box {
    box-shadow: 0 0 0 4px rgba(102,126,234,0.18);
}

/* ==================== LINKS ==================== */
.authcraft-link {
    color: var(--ac-input-focus, #667eea);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.authcraft-link:hover { color: var(--ac-icon-hover, #764ba2); }
.authcraft-link-strong { font-weight: 700; }

/* ==================== BUTTONS ==================== */
.authcraft-btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: var(--ac-btn-radius, 12px);
    background: var(--ac-btn-bg, linear-gradient(135deg, #667eea, #764ba2));
    color: var(--ac-btn-text, #fff);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    margin-top: 6px;
}

.authcraft-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.authcraft-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px -10px rgba(102,126,234,0.55);
}

.authcraft-btn:hover::before { opacity: 1; }

.authcraft-btn:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.authcraft-btn:disabled,
.authcraft-btn.is-loading {
    cursor: not-allowed;
    opacity: 0.85;
}

.authcraft-btn-icon {
    transition: transform 0.3s ease;
}

.authcraft-btn:hover .authcraft-btn-icon {
    transform: translateX(4px);
}

.authcraft-btn-loader {
    display: none;
}

.authcraft-btn.is-loading .authcraft-btn-label,
.authcraft-btn.is-loading .authcraft-btn-icon { display: none; }

.authcraft-btn.is-loading .authcraft-btn-loader { display: inline-flex; }

/* ==================== SOCIAL ==================== */
.authcraft-social-divider {
    text-align: center;
    position: relative;
    margin: 24px 0 18px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.authcraft-social-divider::before,
.authcraft-social-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 70px);
    height: 1px;
    background: linear-gradient(90deg, transparent, #cbd5e0, transparent);
}

.authcraft-social-divider::before { left: 0; }
.authcraft-social-divider::after { right: 0; }

.authcraft-social-buttons {
    display: flex;
    gap: 10px;
}

.authcraft-social-grid { flex-direction: column; }
.authcraft-social-inline { flex-direction: row; flex-wrap: wrap; }

.authcraft-social-btn {
    flex: 1;
    min-height: 48px;
    padding: 0 16px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    color: #1a202c;
    transition: all 0.25s ease;
}

.authcraft-social-btn:hover {
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.authcraft-social-style-pill .authcraft-social-btn { border-radius: 999px; }
.authcraft-social-style-square .authcraft-social-btn { border-radius: 8px; }

.authcraft-social-inline .authcraft-social-btn {
    padding: 0;
    min-width: 48px;
}
.authcraft-social-inline .authcraft-social-label { display: none; }

/* ==================== STRENGTH METER ==================== */
.authcraft-strength {
    margin-top: -6px;
}

.authcraft-strength-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.authcraft-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #ef4444;
    transition: all 0.4s ease;
    border-radius: 4px;
}

.authcraft-strength[data-strength="1"] .authcraft-strength-bar span { width: 25%; background: #ef4444; }
.authcraft-strength[data-strength="2"] .authcraft-strength-bar span { width: 50%; background: #f59e0b; }
.authcraft-strength[data-strength="3"] .authcraft-strength-bar span { width: 75%; background: #3b82f6; }
.authcraft-strength[data-strength="4"] .authcraft-strength-bar span { width: 100%; background: #10b981; }

.authcraft-strength-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

/* ==================== FORM FOOTER ==================== */
.authcraft-form-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--ac-text-color, #718096);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.authcraft-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.authcraft-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    border-left: 4px solid #667eea;
    animation: ac-toast-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 14px;
    color: #1a202c;
    font-weight: 500;
    line-height: 1.45;
}

.authcraft-toast.is-success { border-left-color: #10b981; }
.authcraft-toast.is-error { border-left-color: #ef4444; }
.authcraft-toast.is-info { border-left-color: #3b82f6; }

.authcraft-toast.is-leaving { animation: ac-toast-out 0.3s ease forwards; }

@keyframes ac-toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes ac-toast-out {
    to { opacity: 0; transform: translateX(40px); }
}

.authcraft-toast-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ==================== LOGGED IN ==================== */
.authcraft-loggedin-content {
    text-align: center;
}
.authcraft-loggedin-icon {
    margin: 0 auto 18px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(16,185,129,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ac-success-pulse 2s ease-in-out infinite;
}

@keyframes ac-success-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { box-shadow: 0 0 0 14px rgba(16,185,129,0); }
}

.authcraft-loggedin-content h3 {
    font-size: 24px;
    font-weight: 800;
    color: var(--ac-heading-color, #1a202c);
    margin: 0 0 6px;
}

.authcraft-loggedin-content p {
    margin: 0 0 22px;
    color: var(--ac-text-color, #718096);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 968px) {
    .authcraft-side { display: none !important; }
    .authcraft-main { padding: 30px 16px; }
}

@media (max-width: 480px) {
    .authcraft-card {
        padding: 28px 22px;
        border-radius: 20px;
    }
    .authcraft-title { font-size: 24px; }
    .authcraft-subtitle { font-size: 14px; }
    .authcraft-brand { width: 60px; height: 60px; border-radius: 16px; margin-bottom: 14px; }
    .authcraft-field input { height: 52px; }
    .authcraft-btn { height: 52px; font-size: 14px; }
    .authcraft-toast-container {
        left: 16px;
        right: 16px;
        top: 16px;
        max-width: none;
    }
    .authcraft-form-row { font-size: 13px; }
}

/* ==================== ACCESSIBILITY ==================== */
.authcraft-wrap *:focus-visible {
    outline: 2px solid var(--ac-input-focus, #667eea);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .authcraft-wrap *,
    .authcraft-wrap *::before,
    .authcraft-wrap *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
