/* ==========================================================
   AUTENTICACIÓN
   ========================================================== */

.dsm-auth {
    display: flex;
    justify-content: center;
    padding: var(--dsm-space-7) var(--dsm-space-4);
}

.dsm-auth__card {
    width: 100%;
    max-width: var(--dsm-auth-width);
    padding: var(--dsm-space-6);

    background: var(--dsm-color-surface);
    border: 1px solid var(--dsm-color-border);
    border-radius: var(--dsm-radius-lg);
    box-shadow: var(--dsm-shadow-card);
}

.dsm-auth__header {
    margin-bottom: var(--dsm-space-5);
}

.dsm-auth__title {
    margin-bottom: var(--dsm-space-2);
    font-size: var(--dsm-font-size-2xl);
    line-height: var(--dsm-line-height-sm);
}

.dsm-auth__description {
    margin-bottom: 0;
    color: var(--dsm-color-text-muted);
}

.dsm-auth__footer {
    margin-top: var(--dsm-space-5);
    color: var(--dsm-color-text-muted);
    text-align: center;
}

.dsm-auth__footer p {
    margin-bottom: 0;
}


/* ==========================================================
   FORMULARIOS
   ========================================================== */

.dsm-form {
    display: grid;
    gap: var(--dsm-space-4);
}

.dsm-form__field {
    display: grid;
    gap: var(--dsm-space-2);
}

.dsm-form__label {
    font-size: var(--dsm-font-size-sm);
    font-weight: 700;
}

.dsm-form__input {
    width: 100%;
    min-height: 48px;
    padding: var(--dsm-space-3) var(--dsm-space-4);

    color: var(--dsm-color-text);
    background: var(--dsm-color-surface);

    border: 1px solid var(--dsm-color-border);
    border-radius: var(--dsm-radius-md);

    transition:
        border-color var(--dsm-transition-fast),
        box-shadow var(--dsm-transition-fast);
}

.dsm-form__input:hover {
    border-color: var(--dsm-color-text-muted);
}

.dsm-form__input:focus {
    border-color: var(--dsm-color-focus);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(
        in srgb,
        var(--dsm-color-focus) 18%,
        transparent
    );
}

.dsm-form__textarea {
    min-height: 150px;
    resize: vertical;
}

.dsm-form__help {
    color: var(--dsm-color-text-muted);
    font-size: var(--dsm-font-size-xs);
    line-height: var(--dsm-line-height-sm);
}


/* ==========================================================
   BOTONES
   ========================================================== */

.dsm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;
    padding: var(--dsm-space-3) var(--dsm-space-4);

    border: 0;
    border-radius: var(--dsm-radius-md);

    font-weight: 800;
    line-height: 1;
    text-decoration: none;

    cursor: pointer;

    transition:
        background-color var(--dsm-transition-fast),
        color var(--dsm-transition-fast),
        border-color var(--dsm-transition-fast),
        transform var(--dsm-transition-fast);
}

.dsm-button:hover {
    transform: translateY(-1px);
}

.dsm-button:active {
    transform: translateY(0);
}

.dsm-button--primary {
    color: var(--dsm-color-text-inverse);
    background: var(--dsm-color-primary);
}

.dsm-button--primary:hover {
    color: var(--dsm-color-text-inverse);
    background: var(--dsm-color-primary-hover);
}

.dsm-button--secondary {
    color: var(--dsm-color-primary);
    background: var(--dsm-color-secondary);

    border: 1px solid var(--dsm-color-border);
}

.dsm-button--secondary:hover {
    color: var(--dsm-color-text-inverse);
    background: var(--dsm-color-primary);
    border-color: var(--dsm-color-primary);
}

.dsm-button--block {
    width: 100%;
}


/* ==========================================================
   ALERTAS
   ========================================================== */

.dsm-alert {
    margin-bottom: var(--dsm-space-4);
    padding: var(--dsm-space-4);

    border: 1px solid transparent;
    border-radius: var(--dsm-radius-md);
}

.dsm-alert--error {
    color: var(--dsm-color-error);
    background: var(--dsm-color-error-background);
    border-color: color-mix(
        in srgb,
        var(--dsm-color-error) 20%,
        transparent
    );
}

.dsm-alert--success {
    color: var(--dsm-color-success);
    background: var(--dsm-color-success-background);
    border-color: color-mix(
        in srgb,
        var(--dsm-color-success) 20%,
        transparent
    );
}


/* ==========================================================
   ÁREA PRIVADA
   ========================================================== */

.dsm-account {
    padding: var(--dsm-space-7) 0;
}

.dsm-account__header {
    margin-bottom: var(--dsm-space-5);
}

.dsm-account__title {
    margin-bottom: var(--dsm-space-2);
    font-size: var(--dsm-font-size-2xl);
}

.dsm-account__description {
    color: var(--dsm-color-text-muted);
}

.dsm-account__grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(280px, 1fr)
    );
    gap: var(--dsm-space-5);
}


/* ==========================================================
   TARJETAS
   ========================================================== */

.dsm-card {
    padding: var(--dsm-space-5);

    background: var(--dsm-color-surface);
    border: 1px solid var(--dsm-color-border);
    border-radius: var(--dsm-radius-lg);
    box-shadow: var(--dsm-shadow-sm);
}

.dsm-card--form {
    max-width: 720px;
}

.dsm-card__title {
    margin-bottom: var(--dsm-space-4);
    font-size: var(--dsm-font-size-lg);
}

.dsm-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--dsm-space-3);
}

.dsm-card__actions form {
    margin: 0;
}


/* ==========================================================
   LISTAS DE DEFINICIÓN
   ========================================================== */

.dsm-definition-list {
    display: grid;
    gap: var(--dsm-space-4);
    margin: 0;
}

.dsm-definition-list div {
    display: grid;
    gap: var(--dsm-space-1);
}

.dsm-definition-list dt {
    color: var(--dsm-color-text-muted);
    font-size: var(--dsm-font-size-sm);
    font-weight: 700;
}

.dsm-definition-list dd {
    margin: 0;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 600px) {
    .dsm-auth {
        padding-top: var(--dsm-space-5);
    }

    .dsm-auth__card {
        padding: var(--dsm-space-5);
    }

    .dsm-account {
        padding-top: var(--dsm-space-5);
    }

    .dsm-card__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dsm-card__actions .dsm-button,
    .dsm-card__actions form,
    .dsm-card__actions form .dsm-button {
        width: 100%;
    }
}

/* ==========================================================
   ESTADOS Y AVISOS DE CUENTA
   ========================================================== */

.dsm-alert--warning {
    color: var(--dsm-color-text);
    background: var(--dsm-color-secondary);
    border-color: var(--dsm-color-border);
}

.dsm-alert__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--dsm-space-4);
}

.dsm-alert__content p {
    margin-top: var(--dsm-space-2);
    margin-bottom: 0;
}

.dsm-alert__content form {
    flex: 0 0 auto;
    margin: 0;
}

.dsm-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: var(--dsm-space-1) var(--dsm-space-3);

    border-radius: 999px;

    font-size: var(--dsm-font-size-xs);
    font-weight: 800;
}

.dsm-status--success {
    color: var(--dsm-color-success);
    background: var(--dsm-color-success-background);
}

.dsm-status--warning {
    color: var(--dsm-color-text);
    background: var(--dsm-color-secondary);
    border: 1px solid var(--dsm-color-border);
}

@media (max-width: 600px) {
    .dsm-alert__content {
        align-items: stretch;
        flex-direction: column;
    }

    .dsm-alert__content form,
    .dsm-alert__content .dsm-button {
        width: 100%;
    }
}

/* ==========================================================
   ZONA DE SEGURIDAD DE LA CUENTA
   ========================================================== */

.dsm-account__danger-zone {
    margin-top: var(--dsm-space-6);
}

.dsm-card--danger {
    border-color: color-mix(
        in srgb,
        var(--dsm-color-error) 30%,
        var(--dsm-color-border)
    );
}

.dsm-danger-action {
    margin-top: var(--dsm-space-4);
}

.dsm-danger-action summary {
    list-style: none;
}

.dsm-danger-action summary::-webkit-details-marker {
    display: none;
}

.dsm-danger-action__content {
    margin-top: var(--dsm-space-4);
    padding-top: var(--dsm-space-4);
    border-top: 1px solid var(--dsm-color-border);
}

.dsm-button--danger {
    color: var(--dsm-color-text-inverse);
    background: var(--dsm-color-error);
}

.dsm-button--danger:hover {
    filter: brightness(0.92);
}

.dsm-button--danger-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: var(--dsm-color-error);
    background: transparent;
    border: 1px solid var(--dsm-color-error);

    text-decoration: none;
}

.dsm-button--danger-outline:hover {
    color: var(--dsm-color-text-inverse);
    background: var(--dsm-color-error);
}

/* ==========================================================
   DASHBOARD DE MI CUENTA
   ========================================================== */

.dsm-account .dsm-container {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.dsm-account__header {
    max-width: 760px;
    margin-bottom: var(--dsm-space-6);
}

.dsm-account__title {
    font-size: clamp(
        2rem,
        4vw,
        3rem
    );
}

.dsm-account__description {
    font-size: var(--dsm-font-size-base);
}


/*
 * Perfil + acciones principales.
 */
.dsm-account__grid {
    grid-template-columns:
        minmax(0, 1.35fr)
        minmax(280px, 0.65fr);

    align-items: stretch;
    margin-bottom: var(--dsm-space-5);
}

.dsm-account__grid > .dsm-card {
    height: 100%;
}


/*
 * Módulos aportados por otros plugins:
 *
 * - promociones;
 * - publicidad;
 * - multitienda;
 * - futuros módulos DSM.
 */
.dsm-account__modules {
    display: grid;
    grid-template-columns: repeat(
        2,
        minmax(0, 1fr)
    );
    gap: var(--dsm-space-5);
    margin-top: var(--dsm-space-5);
}

.dsm-account__modules > * {
    min-width: 0;
    margin: 0;
}


/*
 * Los módulos de cuenta no necesitan otra capa
 * de separación visual alrededor de la tarjeta.
 */
.dsm-account-module {
    display: block;
}

.dsm-account-module > .dsm-card {
    height: 100%;
}


/*
 * Contenido interno de Mi publicidad y Mi tienda.
 */
.dsm-account-module__content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--dsm-space-5);
    height: 100%;
}

.dsm-account-module__content p {
    margin-top: 0;
}

.dsm-account-module__summary {
    margin-bottom: 0;
    color: var(--dsm-color-text-muted);
    font-size: var(--dsm-font-size-sm);
}

.dsm-account-module__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--dsm-space-3);
}


/*
 * Las tarjetas principales ganan algo de presencia.
 */
.dsm-account .dsm-card {
    padding: clamp(
        var(--dsm-space-5),
        2.5vw,
        var(--dsm-space-6)
    );
}

.dsm-account .dsm-card__title {
    margin-bottom: var(--dsm-space-3);
    font-size: clamp(
        1.2rem,
        2vw,
        1.5rem
    );
}


/*
 * Zona sensible claramente separada del dashboard.
 */
.dsm-account__danger-zone {
    margin-top: var(--dsm-space-7);
}


/* ==========================================================
   MI CUENTA - TABLET
   ========================================================== */

@media (max-width: 900px) {

    .dsm-account__grid {
        grid-template-columns: 1fr;
    }

    .dsm-account__modules {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   MI CUENTA - MÓVIL
   ========================================================== */

@media (max-width: 600px) {

    .dsm-account .dsm-container {
        width: min(
            100% - 24px,
            1180px
        );
    }

    .dsm-account {
        padding-top: var(--dsm-space-5);
        padding-bottom: var(--dsm-space-6);
    }

    .dsm-account__header {
        margin-bottom: var(--dsm-space-5);
    }

    .dsm-account__title {
        font-size: 2rem;
    }

    .dsm-account__grid,
    .dsm-account__modules {
        gap: var(--dsm-space-4);
    }

    .dsm-account .dsm-card {
        padding: var(--dsm-space-5);
    }

    .dsm-account-module__actions,
    .dsm-account-module__actions .dsm-button {
        width: 100%;
    }

    .dsm-account-module__actions .dsm-button {
        justify-content: center;
    }
}


/* ==========================================================
   MI PUBLICIDAD
   ========================================================== */

.dsm-customer-advertising {
    width: min(
        1180px,
        calc(100% - 32px)
    );
    margin-inline: auto;
    padding-top: var(--dsm-space-7);
    padding-bottom: var(--dsm-space-7);
}

.dsm-customer-advertising__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--dsm-space-5);
    margin-bottom: var(--dsm-space-6);
}

.dsm-customer-advertising__header h1 {
    margin-bottom: var(--dsm-space-2);
    font-size: clamp(
        2rem,
        4vw,
        3rem
    );
}

.dsm-customer-advertising__header p {
    margin: 0;
    color: var(--dsm-color-text-muted);
}

.dsm-customer-advertising__actions {
    flex: 0 0 auto;
}

.dsm-customer-advertising__list {
    display: grid;
    grid-template-columns: repeat(
        2,
        minmax(0, 1fr)
    );
    gap: var(--dsm-space-5);
}

.dsm-customer-advertising__item {
    overflow: hidden;
    padding: var(--dsm-space-5);

    background: var(--dsm-color-surface);
    border: 1px solid var(--dsm-color-border);
    border-radius: var(--dsm-radius-lg);
    box-shadow: var(--dsm-shadow-sm);
}

.dsm-customer-advertising__item img {
    display: block;
    width: 100%;
    max-height: 260px;
    margin-bottom: var(--dsm-space-4);

    object-fit: cover;
    border-radius: var(--dsm-radius-md);
}

@media (max-width: 760px) {

    .dsm-customer-advertising {
        width: min(
            100% - 24px,
            1180px
        );
        padding-top: var(--dsm-space-5);
        padding-bottom: var(--dsm-space-6);
    }

    .dsm-customer-advertising__header {
        align-items: stretch;
        flex-direction: column;
    }

    .dsm-customer-advertising__actions,
    .dsm-customer-advertising__actions .dsm-button {
        width: 100%;
    }

    .dsm-customer-advertising__actions .dsm-button {
        justify-content: center;
    }

    .dsm-customer-advertising__list {
        grid-template-columns: 1fr;
    }
}
