/* ===========================
   Moje Konto
   =========================== */

/* Kontener główny dla układu */
.account-main-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    align-items: flex-start;
}

.account-left-column {
    flex: 1;
    min-width: 300px;
}

.account-right-column {
    flex: 1;
    min-width: 300px;
}

/* Responsywność dla mobile */
@media (max-width: 768px) {
    .account-main-grid {
        flex-direction: column;
        gap: 2rem;
    }

    /* Zmiana kolejności:
       1. Twoje dane (.account-left-column .user-data-section)
       2. Aktywuj urządzenie (.account-right-column .activate-device-section)
       3. Zmień hasło (.account-left-column .password-section)

       Używamy order, ale musimy uwzględnić, że sekcje są w różnych kontenerach rodzicach.
       Rozwiązaniem jest display: contents na kontenerach kolumn, aby dzieci stały się dziećmi grida głównego (jeśli użylibyśmy CSS grid).
       Ale przy flex-wrap jest to trudniejsze.
       Lepszym rozwiązaniem dla mobilnych jest display: flex column na głównym kontenerze,
       a display: contents na kolumnach, żeby elementy "wypadły" do głównego kontenera i można było nimi sterować "order".
    */

    .account-main-grid {
        display: flex;
        flex-direction: column;
    }

    .account-left-column,
    .account-right-column {
        display: contents;
        /* Elementy wewnątrz stają się dziećmi .account-main-grid */
    }

    /* Kolejność: */

    /* 1. Twoje dane */
    .user-data-section {
        order: 1;
        width: 100%;
    }

    /* 2. Aktywuj urządzenie */
    .activate-device-section {
        order: 2;
        width: 100%;
        margin-top: 1rem;
    }

    /* 3. Zmień hasło */
    .password-section {
        order: 3;
        width: 100%;
        margin-top: 1rem !important;
        /* Nadpisanie inline style z PHP */
    }

    /* 4. Pomoc techniczna */
    .support-section {
        order: 4;
        width: 100%;
        margin-top: 1rem;
    }

    /* 5. Tabela "Twoje urządzenia" jest poza .account-main-grid w HTML, więc jest naturalnie na dole */
}

/* Style alertów (Flash Messages) — oparte o theme.css */
.atfpro-alert {
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-base);
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-out;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.atfpro-alert-success {
    background-color: color-mix(in srgb, var(--theme-success) 12%, transparent);
    color: var(--theme-success);
    border: 1px solid color-mix(in srgb, var(--theme-success) 25%, transparent);
}

.atfpro-alert-error {
    background-color: color-mix(in srgb, var(--theme-error) 12%, transparent);
    color: var(--theme-error);
    border: 1px solid color-mix(in srgb, var(--theme-error) 25%, transparent);
}

.atfpro-alert-info {
    background-color: color-mix(in srgb, var(--theme-info) 12%, transparent);
    color: var(--theme-info);
    border: 1px solid color-mix(in srgb, var(--theme-info) 25%, transparent);
}

/* Rozszerzony alert sukcesu z PIN-em po aktywacji urządzenia.
   Helper atfpro_render_flash_alert() renderuje .atfpro-alert__pin-box gdy flash data zawiera 'pin'. */
.atfpro-alert {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
}

.atfpro-alert__message {
    font-size: 1.05rem;
    font-weight: 600;
    /* pre-line zachowuje \n z flash message (np. info o wysłaniu maila + folder spam) */
    white-space: pre-line;
}

/* Wyróżniona wartość pod komunikatem — flash data['detail'].
   Uzywane m.in. na /add-distributor/: adres, na ktory poszedl mail powitalny z haslem,
   ma byc czytelny na pierwszy rzut oka, bo to jedyne potwierdzenie dla pracownika. */
.atfpro-alert__detail {
    margin-top: 0.5rem;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--theme-heading);
    word-break: break-all;
}

/* Link akcji w alercie — flash data['action'].
   Wszystkie stany jawnie, bo reset.css nie stylizuje linkow w alertach. */
.atfpro-alert__action {
    align-self: center;
    margin-top: 1rem;
    padding: 0.6rem 1.25rem;
    border: 1px solid currentColor;
    border-radius: var(--radius-base, 0.5rem);
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.atfpro-alert__action:hover,
.atfpro-alert__action:focus,
.atfpro-alert__action:active,
.atfpro-alert__action:focus-visible {
    background-color: color-mix(in srgb, currentColor 14%, transparent);
    color: inherit;
    text-decoration: none;
}

.atfpro-alert__pin-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--theme-card-bg);
    border: 1px dashed color-mix(in srgb, var(--theme-success) 50%, transparent);
    border-radius: var(--radius-base, 0.5rem);
}

.atfpro-alert__pin-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--theme-text-muted);
    font-weight: 600;
}

.atfpro-alert__pin-value {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--theme-heading);
    letter-spacing: 4px;
    line-height: 1.1;
}

@media (max-width: 480px) {
    .atfpro-alert__pin-value {
        font-size: 1.8rem;
        letter-spacing: 3px;
    }
}

/* Drobne poprawki */
.user-details {
    margin-bottom: 0;
}

.activate-device-section {
    /* Usunięcie stylów ciemnego motywu, aby pasował do reszty sekcji (białe tło/domyślne) */
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.activate-device-section .section-title {
    margin-top: 0;
}

/* ==========================================================================
   Pomoc techniczna
   ========================================================================== */

.support-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.support-action-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.125rem 1.5rem;
    border-radius: var(--radius-base);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.support-action-primary {
    background: var(--theme-bg-alt);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    transition: all 0.2s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.support-action-primary:hover {
    border-color: var(--theme-link);
    color: var(--theme-link);
    transform: translateY(-1px);
    box-shadow: var(--theme-shadow-sm);
}

.support-action-secondary {
    background: var(--theme-bg-alt);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    transition: all 0.2s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.support-action-secondary:hover {
    border-color: var(--theme-link);
    color: var(--theme-link);
    transform: translateY(-1px);
    box-shadow: var(--theme-shadow-sm);
}

.support-action-icon {
    font-size: 2rem;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.support-action-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.support-action-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.support-action-desc {
    font-size: 0.8125rem;
    opacity: 0.75;
    line-height: 1.4;
}

