/**
 * Flæske User Authentication - Brand Guidelines Implementation
 * COMPLETELY ISOLATED - Unique class names to prevent ANY conflicts
 * Mobile-first responsive design
 * EXACT brand guidelines compliance
 */

/* Brand Colors - Isolated Scope */
.flaeske-auth-brand-wrapper {
    --flaeske-brand-green: #4A7C59;
    --flaeske-brand-green-hover: #3a6346;
    --flaeske-brand-charcoal: #2C2C2C;
    --flaeske-brand-cream: #F9F7F2;
    --flaeske-brand-error: #EF4444;
    --flaeske-gray-100: #f3f4f6;
    --flaeske-gray-200: #e5e7eb;
    --flaeske-gray-300: #d1d5db;
    --flaeske-gray-400: #9ca3af;
    --flaeske-gray-500: #6b7280;
}

/* Complete Isolation Wrapper */
.flaeske-auth-brand-wrapper {
    isolation: isolate;
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
}

.flaeske-auth-brand-wrapper *,
.flaeske-auth-brand-wrapper *::before,
.flaeske-auth-brand-wrapper *::after {
    box-sizing: border-box;
}

/* Two Column Layout for Desktop */
@media (min-width: 900px) {
    .flaeske-auth-brand-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        max-width: 960px;
        padding: 40px 20px;
        align-items: start;
    }
}

@media (min-width: 1100px) {
    .flaeske-auth-brand-wrapper {
        gap: 50px;
        max-width: 1100px;
        padding: 50px 30px;
    }
}

/* Standalone Forms */
.flaeske-auth-brand-standalone {
    display: block;
    max-width: 100%;
}

@media (min-width: 500px) {
    .flaeske-auth-brand-standalone {
        max-width: 440px;
        margin: 0 auto;
        padding: 30px 20px;
    }
}

@media (min-width: 768px) {
    .flaeske-auth-brand-standalone {
        max-width: 480px;
        padding: 50px 20px;
    }
}

/* ==========================================================================
   Card Container
   ========================================================================== */

.flaeske-auth-brand-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--flaeske-gray-100);
    overflow: hidden;
    width: 100%;
    position: relative;
}

@media (min-width: 500px) {
    .flaeske-auth-brand-card {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 10px 20px rgba(0, 0, 0, 0.06);
    }
}

/* ==========================================================================
   Tabs - EXACT Brand Guidelines (forms.html line 209-218)
   ========================================================================== */

.flaeske-auth-brand-tabs {
    display: flex;
    border-bottom: 1px solid var(--flaeske-gray-100);
    background: white;
    padding: 0;
    margin: 0;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-tab,
.flaeske-auth-brand-tab {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 16px 8px !important;
    background: white !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: var(--flaeske-gray-400) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-height: 48px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    position: relative !important;
    margin: 0 !important;
    text-align: center !important;
}

@media (min-width: 375px) {
    .flaeske-auth-brand-wrapper .flaeske-auth-brand-tab,
    .flaeske-auth-brand-tab {
        gap: 8px !important;
        padding: 16px 12px !important;
    }
}

@media (min-width: 500px) {
    .flaeske-auth-brand-wrapper .flaeske-auth-brand-tab,
    .flaeske-auth-brand-tab {
        padding: 16px 16px !important;
    }
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-tab:hover,
.flaeske-auth-brand-tab:hover {
    color: var(--flaeske-brand-charcoal) !important;
    background: var(--flaeske-gray-100) !important;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-tab.flaeske-auth-brand-tab-active,
.flaeske-auth-brand-tab.flaeske-auth-brand-tab-active {
    color: #2C2C2C !important; /* brand-charcoal */
    font-weight: 700 !important;
    border-bottom-color: #4A7C59 !important; /* brand-green */
    border-bottom-width: 2px !important;
    background: rgba(249, 247, 242, 0.3) !important; /* brand-cream/30 */
}

.flaeske-auth-brand-tab-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: inherit;
}

.flaeske-auth-brand-tab-text {
    white-space: nowrap;
}

/* ==========================================================================
   Form Container
   ========================================================================== */

.flaeske-auth-brand-form-container {
    padding: 24px 16px;
}

@media (min-width: 375px) {
    .flaeske-auth-brand-form-container {
        padding: 28px 20px;
    }
}

@media (min-width: 500px) {
    .flaeske-auth-brand-form-container {
        padding: 32px 28px;
    }
}

@media (min-width: 768px) {
    .flaeske-auth-brand-form-container {
        padding: 40px 35px;
    }
}

.flaeske-auth-brand-form-panel {
    display: none;
}

.flaeske-auth-brand-form-panel.flaeske-auth-brand-form-panel-active {
    display: block;
    animation: flaeske-auth-brand-fadeIn 0.3s ease;
}

@keyframes flaeske-auth-brand-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Form Fields - EXACT Brand Guidelines (forms.html line 12-14)
   ========================================================================== */

.flaeske-auth-brand-field {
    margin-bottom: 20px;
}

@media (min-width: 500px) {
    .flaeske-auth-brand-field {
        margin-bottom: 24px;
    }
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-label,
.flaeske-auth-brand-label {
    display: block !important;
    margin-bottom: 8px !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: var(--flaeske-brand-charcoal) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    line-height: 1.5 !important;
}

.flaeske-auth-brand-required {
    color: var(--flaeske-brand-error);
    font-weight: 400;
}

/* Input - EXACT Brand Guidelines - FORCE with !important */
/* Matches: px-4 py-3 rounded-lg border border-gray-300 focus:border-brand-green focus:ring-1 */
.flaeske-auth-brand-wrapper .flaeske-auth-brand-input,
.flaeske-auth-brand-input {
    width: 100% !important;
    padding: 12px 16px !important; /* px-4 py-3 = 12px 16px */
    font-size: 16px !important; /* Prevents zoom on iOS */
    border: 1px solid #d1d5db !important; /* border-gray-300 */
    border-radius: 0.5rem !important; /* rounded-lg = 8px */
    background: #ffffff !important;
    color: #2C2C2C !important; /* brand-charcoal */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important; /* Subtle shadow */
    margin: 0 !important;
    line-height: 1.5 !important;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-input:focus,
.flaeske-auth-brand-input:focus {
    outline: none !important;
    border-color: #4A7C59 !important; /* brand-green */
    box-shadow: 0 0 0 1px #4A7C59 !important; /* focus:ring-1 ring-brand-green */
}

.flaeske-auth-brand-input::placeholder {
    color: var(--flaeske-gray-400);
    font-size: 0.95rem;
}

.flaeske-auth-brand-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--flaeske-gray-500);
    line-height: 1.4;
}

@media (min-width: 500px) {
    .flaeske-auth-brand-hint {
        font-size: 0.8rem;
        margin-top: 8px;
    }
}

/* Password Wrapper */
.flaeske-auth-brand-password-wrapper {
    position: relative;
}

.flaeske-auth-brand-password-wrapper .flaeske-auth-brand-input {
    padding-right: 48px;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-password-toggle,
.flaeske-auth-brand-password-toggle {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    padding: 8px !important;
    cursor: pointer !important;
    opacity: 0.6 !important;
    transition: opacity 0.2s ease !important;
    min-width: 40px !important;
    min-height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-password-toggle:hover,
.flaeske-auth-brand-wrapper .flaeske-auth-brand-password-toggle:focus,
.flaeske-auth-brand-password-toggle:hover,
.flaeske-auth-brand-password-toggle:focus {
    opacity: 1 !important;
    outline: none !important;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-password-toggle-icon,
.flaeske-auth-brand-password-toggle-icon {
    width: 1.25rem !important;
    height: 1.25rem !important;
    color: var(--flaeske-gray-500) !important;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-password-toggle:hover .flaeske-auth-brand-password-toggle-icon,
.flaeske-auth-brand-password-toggle:hover .flaeske-auth-brand-password-toggle-icon {
    color: var(--flaeske-brand-green) !important;
}

/* Password Strength */
.flaeske-auth-brand-password-strength {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flaeske-auth-brand-password-strength-bar {
    flex: 1;
    height: 4px;
    background: var(--flaeske-gray-300);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.flaeske-auth-brand-password-strength-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--flaeske-brand-error);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.flaeske-auth-brand-password-strength.flaeske-auth-brand-strength-weak .flaeske-auth-brand-password-strength-bar::after {
    width: 25%;
    background: var(--flaeske-brand-error);
}

.flaeske-auth-brand-password-strength.flaeske-auth-brand-strength-fair .flaeske-auth-brand-password-strength-bar::after {
    width: 50%;
    background: #f59e0b;
}

.flaeske-auth-brand-password-strength.flaeske-auth-brand-strength-good .flaeske-auth-brand-password-strength-bar::after {
    width: 75%;
    background: #10b981;
}

.flaeske-auth-brand-password-strength.flaeske-auth-brand-strength-strong .flaeske-auth-brand-password-strength-bar::after {
    width: 100%;
    background: #059669;
}

.flaeske-auth-brand-password-strength-text {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--flaeske-gray-400);
    min-width: 50px;
    text-align: right;
}

/* ==========================================================================
   Checkbox - Brand Guidelines
   ========================================================================== */

.flaeske-auth-brand-field-inline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

@media (min-width: 400px) {
    .flaeske-auth-brand-field-inline {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
}

.flaeske-auth-brand-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    min-height: 44px;
    padding: 4px 0;
    margin: 0;
}

.flaeske-auth-brand-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.flaeske-auth-brand-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 1px solid var(--flaeske-gray-300);
    border-radius: 4px;
    background: white;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.flaeske-auth-brand-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 14px;
    color: white;
    font-weight: bold;
    transition: transform 0.15s ease;
}

.flaeske-auth-brand-checkbox-input:checked + .flaeske-auth-brand-checkbox-custom {
    background: var(--flaeske-brand-green);
    border-color: var(--flaeske-brand-green);
}

.flaeske-auth-brand-checkbox-input:checked + .flaeske-auth-brand-checkbox-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.flaeske-auth-brand-checkbox-input:focus + .flaeske-auth-brand-checkbox-custom {
    box-shadow: 0 0 0 1px var(--flaeske-brand-green);
}

.flaeske-auth-brand-checkbox-text {
    font-size: 0.875rem;
    color: var(--flaeske-brand-charcoal);
    line-height: 1.4;
    font-weight: 700;
}

.flaeske-auth-brand-checkbox-text a {
    color: var(--flaeske-brand-green);
    text-decoration: none;
}

.flaeske-auth-brand-checkbox-text a:hover {
    text-decoration: underline;
}

.flaeske-auth-brand-forgot-link {
    font-size: 0.875rem;
    color: var(--flaeske-brand-green);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 8px 0;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.flaeske-auth-brand-forgot-link:hover {
    color: var(--flaeske-brand-charcoal);
    text-decoration: underline;
}

/* ==========================================================================
   Button - EXACT Brand Guidelines (ui-kit.html line 10-12)
   ========================================================================== */

.flaeske-auth-brand-wrapper .flaeske-auth-brand-button,
.flaeske-auth-brand-button {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 16px 32px !important; /* py-4 px-8 = 16px 32px */
    font-size: 1rem !important;
    font-weight: 700 !important; /* font-bold */
    color: #ffffff !important; /* text-white */
    background: #4A7C59 !important; /* bg-brand-green */
    border: none !important;
    border-radius: 0.5rem !important; /* rounded-lg = 8px */
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important; /* shadow-sm */
    position: relative !important;
    overflow: hidden !important;
    min-height: 48px !important;
    -webkit-tap-highlight-color: transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    text-decoration: none !important;
    margin: 0 !important;
    text-align: center !important;
}

.flaeske-auth-brand-wrapper .flaeske-auth-brand-button:hover,
.flaeske-auth-brand-button:hover {
    background: #3a6346 !important; /* hover:bg-[#3a6346] */
    color: #ffffff !important;
}

.flaeske-auth-brand-button:active {
    transform: translateY(0);
}

.flaeske-auth-brand-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.flaeske-auth-brand-button-loader {
    display: none;
}

.flaeske-auth-brand-button.flaeske-auth-brand-button-loading .flaeske-auth-brand-button-text {
    display: none;
}

.flaeske-auth-brand-button.flaeske-auth-brand-button-loading .flaeske-auth-brand-button-loader {
    display: flex !important;
}

.flaeske-auth-brand-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: flaeske-auth-brand-spin 0.8s linear infinite;
}

@keyframes flaeske-auth-brand-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Form Messages
   ========================================================================== */

.flaeske-auth-brand-message {
    padding: 12px 16px;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.flaeske-auth-brand-message.flaeske-auth-brand-message-error {
    background: rgba(254, 242, 242, 0.5);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flaeske-auth-brand-message.flaeske-auth-brand-message-success {
    background: rgba(240, 253, 244, 0.5);
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.flaeske-auth-brand-footer {
    padding: 16px 16px;
    text-align: center;
    background: var(--flaeske-brand-cream);
    border-top: 1px solid var(--flaeske-gray-100);
}

@media (min-width: 500px) {
    .flaeske-auth-brand-footer {
        padding: 22px 28px;
    }
}

.flaeske-auth-brand-footer-text {
    margin: 0;
    font-size: 0.8rem;
    color: var(--flaeske-gray-500);
    line-height: 1.5;
}

.flaeske-auth-brand-footer-text a {
    color: var(--flaeske-brand-green);
    text-decoration: none;
    font-weight: 500;
}

.flaeske-auth-brand-footer-text a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Benefits Section (Desktop Only)
   ========================================================================== */

.flaeske-auth-brand-benefits {
    display: none;
}

@media (min-width: 900px) {
    .flaeske-auth-brand-benefits {
        display: block;
        padding: 30px;
        background: var(--flaeske-brand-cream);
        border-radius: 1rem;
        border: 1px solid rgba(74, 124, 89, 0.1);
        position: sticky;
        top: 100px;
    }
}

.flaeske-auth-brand-benefits-title {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--flaeske-brand-green);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.flaeske-auth-brand-benefits-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.flaeske-auth-brand-benefits-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(74, 124, 89, 0.1);
}

.flaeske-auth-brand-benefits-item:last-child {
    border-bottom: none;
}

.flaeske-auth-brand-benefits-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 0.625rem;
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.1);
    flex-shrink: 0;
    color: var(--flaeske-brand-green);
}

.flaeske-auth-brand-benefits-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.flaeske-auth-brand-benefits-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.flaeske-auth-brand-benefits-content strong {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--flaeske-brand-charcoal);
}

.flaeske-auth-brand-benefits-content span {
    font-size: 0.8rem;
    color: var(--flaeske-gray-500);
    line-height: 1.4;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 320px) {
    .flaeske-auth-brand-wrapper {
        padding: 8px 6px;
    }
    
    .flaeske-auth-brand-form-container {
        padding: 16px 12px;
    }
    
    .flaeske-auth-brand-tab {
        padding: 12px 4px;
        font-size: 0.75rem;
    }
    
    .flaeske-auth-brand-input {
        padding: 11px 12px;
    }
    
    .flaeske-auth-brand-button {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}

