/**
 * Modern Authentication Pages Stylesheet
 * Inventory Management System
 *
 * This file provides styling for authentication pages
 * including layout, forms, buttons, and themes.
 */

/* ========================================
   BASE STYLES
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ========================================
   CONTAINER & CARD STYLES
   ======================================== */

.auth-container {
    width: 100%;
    max-width: 580px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

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

/* ========================================
   HEADER STYLES
   ======================================== */

.auth-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 20px;
    text-align: center;
}

.auth-header-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 30px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 14px;
    opacity: 0.9;
}

.auth-logo {
    max-width: 200px;
    margin-top: 15px;
    margin-bottom:0px
}

/* ========================================
   BODY STYLES
   ======================================== */

.auth-body {
    padding: 40px 30px;
}

/* ========================================
   FORM STYLES
   ======================================== */

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #999;
}

/* ========================================
   CHECKBOX STYLES
   ======================================== */

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

/* ========================================
   FORM ACTIONS & LINKS
   ======================================== */

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 20px;
}

.forgot-link {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: #764ba2;
}

/* ========================================
   BUTTON STYLES
   ======================================== */

.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: #f0f2f5;
    color: #333;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #e1e8ed;
}

/* ========================================
   ALERT STYLES
   ======================================== */

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========================================
   TEXT & FOOTER STYLES
   ======================================== */

.form-text {
    font-size: 14px;
    color: #666;
    margin-top: 15px;
    text-align: center;
}

.form-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.form-text a:hover {
    color: #764ba2;
}

.auth-footer {
    padding: 20px 30px;
    border-top: 1px solid #e1e8ed;
    text-align: center;
    font-size: 13px;
    color: #666;
}

.error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

/* ========================================
   DIVIDER STYLES
   ======================================== */

.divider {
    text-align: center;
    margin: 25px 0;
    font-size: 14px;
    color: #999;
}

.divider::before,
.divider::after {
    content: '';
    display: inline-block;
    width: 40%;
    height: 1px;
    background: #e1e8ed;
    vertical-align: middle;
}

.divider::before {
    margin-right: 10px;
}

.divider::after {
    margin-left: 10px;
}

/* ========================================
   CSS VARIABLES for easy theming
   ======================================== */

:root {
    --primary-gradient-start: #667eea;
    --primary-gradient-end: #764ba2;
    --success-color: #10b981;
    --error-color: #dc3545;
    --info-color: #0ea5e9;
    --warning-color: #f59e0b;
    --border-color: #e1e8ed;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-light: #f9fafb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus Visible Outline */
:focus-visible {
    outline: 2px solid var(--primary-gradient-start);
    outline-offset: 2px;
}

/* Input Focus States */
.form-group input:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

/* Button Hover Effects */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
    z-index: 0;
}

.btn:hover::before {
    left: 100%;
}

.btn span {
    position: relative;
    z-index: 1;
}

/* Loading State */
.btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 20px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }

    .auth-card {
        background: #1e293b;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }

    .auth-header {
        background: linear-gradient(135deg, #475569 0%, #334155 100%);
    }

    .form-group label {
        color: #e2e8f0;
    }

    .form-group input,
    .form-group textarea {
        background: #0f172a;
        color: #e2e8f0;
        border-color: #334155;
    }

    .form-group input::placeholder {
        color: #94a3b8;
    }

    .form-text {
        color: #cbd5e1;
    }

    .auth-footer {
        border-top-color: #334155;
        color: #94a3b8;
    }

    .btn-secondary {
        background: #334155;
        color: #e2e8f0;
    }

    .btn-secondary:hover {
        background: #475569;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
    }

    .auth-card {
        margin: 0 -20px;
    }

    .auth-header {
        padding: 25px 20px;
    }

    .auth-body {
        padding: 25px 20px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .forgot-link {
        display: block;
        text-align: center;
        order: 2;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-in-down {
    animation: slideInDown 0.4s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Alternative Color Schemes */

/* Blue Theme */
.auth-card.theme-blue .auth-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
}

.auth-card.theme-blue .btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
}

.auth-card.theme-blue .btn-primary:hover {
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.3);
}

/* Green Theme */
.auth-card.theme-green .auth-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.auth-card.theme-green .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.auth-card.theme-green .btn-primary:hover {
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

/* Red Theme */
.auth-card.theme-red .auth-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.auth-card.theme-red .btn-primary {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.auth-card.theme-red .btn-primary:hover {
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

/* Orange Theme */
.auth-card.theme-orange .auth-header {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.auth-card.theme-orange .btn-primary {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.auth-card.theme-orange .btn-primary:hover {
    box-shadow: 0 10px 20px rgba(249, 115, 22, 0.3);
}

/* Accessibility Improvements */

/* High Contrast Mode */
@media (prefers-contrast: more) {
    .auth-card {
        border: 2px solid var(--border-color);
    }

    .form-group input,
    .form-group textarea {
        border-width: 2px;
    }

    .btn {
        border: 2px solid transparent;
    }

    .btn-primary {
        border: 2px solid var(--primary-gradient-start);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .auth-card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    .btn {
        border: 1px solid var(--border-color);
    }
}

/* Utility Classes */

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

.mt-2 {
    margin-top: 10px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 10px;
}

.mb-4 {
    margin-bottom: 20px;
}

.w-full {
    width: 100%;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 10px;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-75 {
    opacity: 0.75;
}

/* Visibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   SUBMIT BUTTON — LOADING / SPINNER STATE
   ======================================== */

/* Keep label and spinner in a flex row */
.auth-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    transition: opacity 0.2s, background 0.2s;
}

/* Spinner circle — hidden by default */
.auth-submit-btn .btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    /* no animation yet */
    transition: opacity 0.15s;
}

/* Loading state: show spinner + animate */
.auth-submit-btn.is-loading .btn-spinner {
    opacity: 1;
    animation: auth-spin 0.7s linear infinite;
}

/* Loading state: dim the label text slightly */
.auth-submit-btn.is-loading .btn-label {
    opacity: 0.85;
}

/* Disabled appearance while loading */
.auth-submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.75;
}

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