/**
 * WineInsight Authentication Styles
 *
 * @package WineInsight
 * @version 1.1.1
 *
 * ÆNDRINGER v1.1.1:
 * - Fjernet baggrund på auth page (nu transparent/hvid)
 * - "Husk mig" checkbox FIXED - nu venstrestillet
 * - Forbedret container design på desktop
 */

/* ========== Variables ========== */
:root {
    --wine-primary: #5c0f15;
    --wine-dark: #3d0a0f;
    --wine-light: #8b1d25;
    --wine-accent: #c99b7a;
    --cream: #fdfbf9;
    --cream-dark: #f5efeb;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #6b7280;
    --border-color: #e5e0dc;
    --border-light: #f0ebe7;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 50px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
}

/* ========== Auth Page Layout ========== */
.wi-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    /* ÆNDRET: Fjernet gradient baggrund - nu transparent */
    background: transparent;
}

/* ÆNDRET: Fjernet dekorativ baggrund */
.wi-auth-page::before {
    display: none;
}

.wi-auth-container {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    position: relative;
    z-index: 1;
    animation: wi-slideUp 0.4s ease-out;
}

/* TILFØJET: Forbedret container på desktop */
@media (min-width: 768px) {
    .wi-auth-container {
        max-width: 460px;
        padding: 56px 48px;
        border-radius: 20px;
        box-shadow:
            0 4px 6px rgba(0, 0, 0, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.04);
    }
}

.wi-auth-container.wi-auth-narrow {
    max-width: 400px;
}

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

/* ========== Auth Header ========== */
.wi-auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.wi-auth-logo {
    font-size: 56px;
    margin-bottom: 16px;
    animation: wi-bounce 0.6s ease-out;
}

@keyframes wi-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.wi-auth-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--wine-dark);
    margin: 0 0 8px;
}

.wi-auth-header p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ========== Auth Tabs ========== */
.wi-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 4px;
    background: var(--cream);
}

.wi-auth-tab {
    flex: 1;
    padding: 12px 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

.wi-auth-tab:hover {
    color: var(--wine-primary);
}

.wi-auth-tab.active {
    background: var(--wine-primary);
    color: white;
}

/* ========== Form Styles ========== */
.wi-auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wi-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wi-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wi-forgot-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--wine-primary);
    text-decoration: none;
}

.wi-forgot-link:hover {
    text-decoration: underline;
}

.wi-form-group input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    color: var(--text-primary);
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wi-form-group input:focus {
    outline: none;
    border-color: var(--wine-primary);
    box-shadow: 0 0 0 3px rgba(92, 15, 21, 0.1);
}

.wi-form-group input::placeholder {
    color: var(--text-muted);
}

/* Form row (side by side) */
.wi-form-row {
    display: flex;
    gap: 16px;
}

.wi-form-row .wi-form-group {
    flex: 1;
}

.wi-form-separator {
    align-self: flex-end;
    padding-bottom: 16px;
    color: var(--text-muted);
}

/* ========== Password Field ========== */
.wi-password-field {
    position: relative;
    display: flex;
}

.wi-password-field input {
    padding-right: 48px !important;
}

.wi-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.wi-toggle-password:hover {
    color: var(--wine-primary);
}

/* Password strength meter */
.wi-password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.wi-strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.wi-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}

.wi-strength-fill.wi-strength-weak { background: var(--error); }
.wi-strength-fill.wi-strength-fair { background: var(--warning); }
.wi-strength-fill.wi-strength-good { background: #22c55e; }
.wi-strength-fill.wi-strength-strong { background: var(--success); }

.wi-strength-label {
    font-size: 12px;
    font-weight: 600;
    min-width: 50px;
}

.wi-strength-label.wi-strength-weak { color: var(--error); }
.wi-strength-label.wi-strength-fair { color: var(--warning); }
.wi-strength-label.wi-strength-good { color: #22c55e; }
.wi-strength-label.wi-strength-strong { color: var(--success); }

/* ========== Checkbox Styles - FIXED ========== */

/* Checkbox gruppe container - venstrestillet */
.wi-checkbox-group {
    margin-top: 4px;
}

/* FIXED: Selve checkbox label - venstrestillet med !important */
.wi-checkbox-group .wi-checkbox,
label.wi-checkbox {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    /* VIGTIGT: Disse sikrer venstrestilling */
    width: auto !important;
    justify-content: flex-start !important;
    text-align: left !important;
    margin-right: auto !important;
}

.wi-checkbox input[type="checkbox"] {
    display: none;
}

.wi-checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wi-checkbox input:checked + .wi-checkmark {
    background: var(--wine-primary);
    border-color: var(--wine-primary);
}

.wi-checkbox input:checked + .wi-checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.wi-checkbox a {
    color: var(--wine-primary);
    text-decoration: none;
}

.wi-checkbox a:hover {
    text-decoration: underline;
}

/* ========== Checkbox Cards (Preferences) ========== */
.wi-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.wi-checkbox-card {
    cursor: pointer;
}

.wi-checkbox-card input {
    display: none;
}

.wi-checkbox-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--cream);
    transition: all 0.2s ease;
}

.wi-checkbox-card input:checked + .wi-checkbox-card-content {
    border-color: var(--wine-primary);
    background: rgba(92, 15, 21, 0.05);
}

.wi-checkbox-icon {
    font-size: 28px;
}

.wi-checkbox-card-content span:last-child {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ========== Form Messages ========== */
.wi-form-message {
    border-radius: var(--radius-md);
    font-size: 14px;
    text-align: center;
}

.wi-form-message:empty {
    display: none;
}

.wi-form-message.success {
    padding: 14px 16px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.wi-form-message.error {
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.wi-form-message a {
    color: inherit;
    font-weight: 600;
}

/* ========== Buttons ========== */
.wi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--wine-primary), var(--wine-light));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wi-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 15, 21, 0.3);
}

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

.wi-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.wi-btn-full {
    width: 100%;
}

.wi-btn-secondary {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.wi-btn-secondary:hover {
    border-color: var(--wine-primary);
    color: var(--wine-primary);
    box-shadow: none;
}

.wi-btn-danger {
    background: var(--error);
}

.wi-btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Loading spinner */
.wi-spinner {
    animation: wi-spin 1s linear infinite;
}

@keyframes wi-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Shake animation for errors */
@keyframes wi-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.wi-shake {
    animation: wi-shake 0.5s ease;
}

/* ========== Auth Footer ========== */
.wi-auth-footer {
    text-align: center;
    margin-top: 24px;
}

.wi-auth-footer p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.wi-auth-footer a {
    color: var(--wine-primary);
    font-weight: 600;
    text-decoration: none;
}

.wi-auth-footer a:hover {
    text-decoration: underline;
}

/* ========== Divider ========== */
.wi-auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.wi-auth-divider::before,
.wi-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.wi-auth-divider span {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== Account Page ========== */
.wi-account-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.wi-account-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.wi-account-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--cream);
    box-shadow: var(--shadow-sm);
}

.wi-account-info h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    color: var(--wine-dark);
    margin: 0 0 4px;
}

.wi-account-info p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 15px;
}

.wi-member-since {
    color: var(--text-muted) !important;
    font-size: 13px !important;
    margin-top: 8px !important;
}

/* Account navigation */
.wi-account-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 8px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.wi-account-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wi-account-tab:hover {
    background: var(--cream);
    color: var(--wine-primary);
}

.wi-account-tab.active {
    background: var(--wine-primary);
    color: white;
}

/* Tab content */
.wi-tab-content {
    display: none;
}

.wi-tab-content.active {
    display: block;
    animation: wi-fadeIn 0.3s ease;
}

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

/* Account sections */
.wi-account-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.wi-account-section h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    color: var(--wine-dark);
    margin: 0 0 8px;
}

.wi-account-section > p {
    color: var(--text-secondary);
    margin: 0 0 24px;
    font-size: 15px;
}

.wi-account-section form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Danger zone */
.wi-danger-zone {
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.wi-danger-zone h2 {
    color: var(--error);
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
    .wi-auth-page {
        padding: 20px 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .wi-auth-container {
        padding: 32px 24px;
    }

    .wi-auth-header h1 {
        font-size: 26px;
    }

    .wi-form-row {
        flex-direction: column;
        gap: 20px;
    }

    .wi-checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wi-account-header {
        flex-direction: column;
        text-align: center;
    }

    .wi-account-nav {
        flex-wrap: wrap;
    }

    .wi-account-tab {
        flex: 1 1 calc(50% - 4px);
        font-size: 13px;
        padding: 12px;
    }

    .wi-account-tab svg {
        width: 18px;
        height: 18px;
    }

    .wi-account-section {
        padding: 24px 20px;
    }
}

/* ========== Dark Mode Support ========== */
@media (prefers-color-scheme: dark) {
    .wi-auth-page {
        background: transparent;
    }

    .wi-auth-container,
    .wi-account-header,
    .wi-account-nav,
    .wi-account-section {
        background: #2d2622;
        border: 1px solid rgba(255,255,255,0.1);
    }

    .wi-auth-header h1,
    .wi-account-info h1,
    .wi-account-section h2 {
        color: #f5efeb;
    }

    .wi-auth-header p,
    .wi-auth-footer p,
    .wi-form-group label {
        color: #a0998f;
    }

    .wi-form-group input {
        background: #1a1714;
        border-color: rgba(255,255,255,0.15);
        color: #f5efeb;
    }

    .wi-auth-tabs {
        background: #1a1714;
        border-color: rgba(255,255,255,0.1);
    }

    .wi-auth-tab {
        color: #a0998f;
    }

    .wi-btn-secondary {
        border-color: rgba(255,255,255,0.2);
        color: #f5efeb;
    }

    .wi-checkbox-card-content {
        background: #1a1714;
        border-color: rgba(255,255,255,0.1);
    }
}
