/**
 * NaviPos Online - Authentication Styles
 * Minimal, clean design inspired by Spotify/Amazon
 * Aligned with main style.css design system
 */

/* Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body.dark-mode {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ===========================
   AUTH PAGE LAYOUT
   =========================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 1.5rem;
}

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

/* ===========================
   AUTH CARD
   =========================== */
.auth-card {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* ===========================
   HEADER SECTION
   =========================== */
.auth-header {
    padding: 1.75rem 1.75rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    background: var(--card-bg);
}

.logo-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.75rem;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.375rem;
    font-weight: 800;
    color: #000000;
    margin: 0;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin: 0.5rem 0 0;
    font-weight: 400;
    line-height: 1.5;
}

/* ===========================
   FORM SECTION
   =========================== */
.auth-form {
    padding: 1.75rem;
}

.registration-form {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.registration-form::-webkit-scrollbar {
    width: 4px;
}

.registration-form::-webkit-scrollbar-track {
    background: transparent;
}

.registration-form::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.registration-form::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
}

.form-helper-text {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.8125rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 800;
    color: #000000;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    margin-right: 0.375rem;
    color: var(--brand-primary);
    font-size: 0.75rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--form-border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--form-bg);
    color: var(--form-text);
    transition: all 0.2s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--form-placeholder);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--form-border-focus);
    background: var(--form-bg);
    box-shadow: 0 0 0 2px var(--color-focus);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Password Toggle */
.password-toggle {
    position: relative;
}

.password-toggle input {
    width: 100%;
}

.password-toggle-btn {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn:hover {
    color: var(--text-primary);
}

/* Password Strength */
.password-strength {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    background: var(--bg-secondary);
    font-size: 0.75rem;
}

.strength-bar {
    height: 3px;
    background: var(--border-primary);
    border-radius: 2px;
    margin-bottom: 0.4rem;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-weak .strength-bar-fill {
    width: 33%;
    background: #ef4444;
}

.strength-medium .strength-bar-fill {
    width: 66%;
    background: #f59e0b;
}

.strength-strong .strength-bar-fill {
    width: 100%;
    background: #10b981;
}

.strength-text {
    font-weight: 600;
    display: block;
}

.strength-weak .strength-text {
    color: #ef4444;
}

.strength-medium .strength-text {
    color: #f59e0b;
}

.strength-strong .strength-text {
    color: #10b981;
}

/* Form Rows */
.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(1px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.col-6 {
    grid-column: span 1;
}

/* Form Checks */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
}

.form-check-input {
    width: 16px;
    height: 16px;
    margin-top: 0.25rem;
    cursor: pointer;
    accent-color: var(--brand-primary);
    border: 1px solid var(--form-border);
    border-radius: 3px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.form-check-input:hover {
    border-color: var(--brand-primary);
}

.form-check-input:checked {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-label {
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1.5;
}

.form-check-label a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.form-check-label a:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

/* ===========================
   FORM ACTIONS
   =========================== */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.remember-me input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand-primary);
    border: 1px solid var(--form-border);
    border-radius: 3px;
}

.remember-me label {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    cursor: pointer;
    margin: 0;
    line-height: 1.5;
}

.forgot-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.forgot-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
}

.btn-auth {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-size: 0.9375rem;
    margin-top: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.btn-auth:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    background: var(--btn-primary-hover);
}

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

.btn-auth.loading {
    opacity: 0.8;
    pointer-events: none;
}

.btn-auth.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-social {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--form-border);
    background: var(--form-bg);
    color: var(--form-text);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-social:hover {
    border-color: var(--brand-primary);
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.btn-google {
    color: var(--form-text);
}

.btn-microsoft {
    color: var(--form-text);
}

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.alert i {
    flex-shrink: 0;
    margin-top: 0.125rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--alert-success-bg);
    border: 1px solid var(--alert-success-border);
    color: var(--alert-success-text);
}

.alert-success i {
    color: inherit;
}

.alert-danger {
    background: var(--alert-danger-bg);
    border: 1px solid var(--alert-danger-border);
    color: var(--alert-danger-text);
}

.alert-danger i {
    color: inherit;
}

.alert-warning {
    background: var(--alert-warning-bg);
    border: 1px solid var(--alert-warning-border);
    color: var(--alert-warning-text);
}

.alert-warning i {
    color: inherit;
}

.alert-info {
    background: var(--alert-info-bg);
    border: 1px solid var(--alert-info-border);
    color: var(--alert-info-text);
}

.alert-info i {
    color: inherit;
}

.alert div {
    flex: 1;
}

/* ===========================
   SOCIAL LOGIN
   =========================== */
.social-login {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

.social-login-title {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.social-login-title::before,
.social-login-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border-primary);
}

.social-login-title::before {
    left: 0;
}

.social-login-title::after {
    right: 0;
}

.social-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ===========================
    FOOTER
    =========================== */
.auth-footer {
    padding: 1.25rem 1.75rem;
    text-align: center;
    border-top: 1px solid var(--card-border);
    background: var(--bg-secondary);
}

.auth-footer p {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.5;
}

.auth-footer a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

/* ===========================
    COPYRIGHT SECTION
    =========================== */
.auth-copyright {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.auth-copyright p {
    margin: 0;
    line-height: 1.5;
}

.auth-links {
    margin-top: 0.5rem;
}

.auth-links a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

/* ===========================
   SECTION HEADERS
   =========================== */
.auth-form h6 {
    font-size: 0.8125rem;
    font-weight: 700;
    margin: 1.25rem 0 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.auth-form h6 i {
    color: var(--brand-primary);
    font-size: 0.8125rem;
}

.auth-form h6:first-child {
    margin-top: 0;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 640px) {
    .auth-wrapper {
        padding: 1rem;
    }

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

    .auth-header {
        padding: 1.5rem 1.5rem 1.25rem;
    }

    .auth-form {
        padding: 1.5rem;
    }

    .logo {
        width: 44px;
        height: 44px;
        font-size: 1.375rem;
    }

    .brand-name {
        font-size: 1.125rem;
    }

    .auth-subtitle {
        font-size: 0.75rem;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1rem;
    }

    .remember-me {
        margin-bottom: 0;
    }

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

    .row {
        grid-template-columns: 1fr;
    }

    .social-buttons {
        grid-template-columns: 1fr;
    }

    .auth-footer {
        padding: 1rem 1.5rem;
    }

    .registration-form {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 480px) {
    .auth-wrapper {
        padding: 1rem;
    }

    .auth-header {
        padding: 1.25rem 1.25rem 1rem;
    }

    .auth-form {
        padding: 1.25rem;
    }

    .logo {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .brand-name {
        font-size: 1rem;
    }

    .auth-subtitle {
        font-size: 0.75rem;
    }

    .form-group {
        margin-bottom: 0.875rem;
    }

    .form-group label {
        margin-bottom: 0.375rem;
        font-size: 0.75rem;
    }

    .btn-auth {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .alert {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }

    .social-login {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
    }

    .social-buttons {
        gap: 0.5rem;
    }

    .btn-social {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }
}

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

.btn:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-check-input:focus-visible,
.forgot-link:focus-visible,
.auth-footer a:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Organization Selection Cards */
.org-cards-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.org-select-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.org-select-card:hover {
    border-color: #007bff;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.org-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.org-card-icon i {
    color: white;
    font-size: 1.25rem;
}

.org-card-content {
    flex: 1;
    min-width: 0;
}

.org-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.org-default-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #10b981;
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.org-card-code {
    font-size: 0.8125rem;
    color: #6b7280;
}

.org-card-arrow {
    color: #9ca3af;
    font-size: 0.875rem;
    margin-left: 0.75rem;
    transition: all 0.2s ease;
}

.org-select-card:hover .org-card-arrow {
    color: #007bff;
    transform: translateX(4px);
}
