/**
 * WS-ERP Login Widget Styles
 *
 * Animated login form with:
 * - Fade-in animations
 * - Floating labels (Material Design)
 *
 * @package WS_ERP
 */

/* ==========================================================================
   Fade-In Animation
   ========================================================================== */

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

@keyframes wsErpFadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Container
   ========================================================================== */

.ws-erp-login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    animation: wsErpFadeIn 0.6s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   Title & Subtitle
   ========================================================================== */

.ws-erp-login-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
    text-align: center;
    animation: wsErpFadeIn 0.6s ease-out 0.1s backwards;
}

.ws-erp-login-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 32px 0;
    text-align: center;
    animation: wsErpFadeIn 0.6s ease-out 0.15s backwards;
}

/* ==========================================================================
   Error Message
   ========================================================================== */

.ws-erp-login-error {
    background: #FEE2E2;
    color: #B91C1C;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: wsErpFadeInScale 0.3s ease-out;
}

/* ==========================================================================
   Form Groups with Floating Labels
   ========================================================================== */

.ws-erp-login-form {
    display: block;
}

.ws-erp-form-group {
    position: relative;
    margin-bottom: 24px;
    animation: wsErpFadeIn 0.6s ease-out backwards;
}

/* Staggered animation delays */
.ws-erp-form-group:nth-child(1) {
    animation-delay: 0.2s;
}

.ws-erp-form-group:nth-child(2) {
    animation-delay: 0.25s;
}

.ws-erp-form-group:nth-child(3) {
    animation-delay: 0.3s;
}

/* Input Fields */
.ws-erp-form-group input[type="text"],
.ws-erp-form-group input[type="password"],
.ws-erp-form-group input[type="email"] {
    width: 100%;
    padding: 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    background: transparent;
    box-sizing: border-box;
}

.ws-erp-form-group input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Floating Label */
.ws-erp-form-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6B7280;
    font-size: 15px;
    font-weight: 400;
    transition: all 0.2s ease;
    pointer-events: none;
    background: #fff;
    padding: 0 6px;
    margin: 0;
}

/* Float label up when focused or has value */
/* Using ~ (general sibling) instead of + (adjacent sibling) for compatibility
   with plugins that insert elements between input and label (e.g., password strength indicators) */
.ws-erp-form-group input:focus ~ label,
.ws-erp-form-group input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 11px;
    font-weight: 600;
    color: #2563EB;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Remember Me Checkbox
   ========================================================================== */

.ws-erp-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    animation: wsErpFadeIn 0.6s ease-out 0.35s backwards;
}

.ws-erp-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2563EB;
    cursor: pointer;
    margin: 0;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

.ws-erp-login-btn {
    width: 100%;
    padding: 14px 24px;
    background: #2563EB;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: wsErpFadeIn 0.6s ease-out 0.4s backwards;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ws-erp-login-btn:hover {
    background: #1D4ED8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.ws-erp-login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.ws-erp-login-btn:disabled,
.ws-erp-login-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

.ws-erp-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wsErpSpin 0.8s linear infinite;
}

@keyframes wsErpSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 480px) {
    .ws-erp-login-container {
        padding: 32px 24px;
        margin: 0 16px;
        border-radius: 12px;
    }

    .ws-erp-login-title {
        font-size: 22px;
    }

    .ws-erp-login-subtitle {
        font-size: 13px;
        margin-bottom: 28px;
    }

    .ws-erp-form-group input {
        padding: 14px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .ws-erp-login-btn {
        padding: 14px 20px;
    }
}

/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .ws-erp-login-container.dark-mode {
        background: #1F2937;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    }

    .ws-erp-login-container.dark-mode .ws-erp-login-title {
        color: #F9FAFB;
    }

    .ws-erp-login-container.dark-mode .ws-erp-login-subtitle {
        color: #9CA3AF;
    }

    .ws-erp-login-container.dark-mode .ws-erp-form-group input {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }

    .ws-erp-login-container.dark-mode .ws-erp-form-group label {
        background: #1F2937;
        color: #9CA3AF;
    }

    .ws-erp-login-container.dark-mode .ws-erp-remember {
        color: #D1D5DB;
    }
}
