html,
body {
    height: 100%;
}

.login-body {
    background-color: var(--app-background, #f8f9fa);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    min-height: 100vh;
}

.login-body::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
}

.login-wrapper {
    width: 100%;
    max-width: 360px;
    position: relative;
    z-index: 1;
}

.login-card {
    border: none;
    border-top: 4px solid var(--app-accent, transparent);
    border-radius: 1rem;
    background-color: var(--app-background, #f8f9fa);
    color: var(--app-text, inherit);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
}

.login-logo {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
}

.login-powered-by,
.app-powered-by {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.login-card .btn-primary {
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.login-card .btn-light {
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-weight: 500;
    padding: 0.75rem 1rem;
}

.login-card .btn-link {
    font-weight: 500;
    text-decoration: none;
}

.login-card .btn-link:hover {
    text-decoration: underline;
}

.login-card hr {
    border-top-color: var(--app-text);
    opacity: 0.2;
}

.login-card .text-muted {
    color: var(--app-text) !important;
    opacity: 0.65;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-google i {
    color: #4285F4;
}

/* --- Aplicación autenticada --- */

body {
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background-color: var(--navbar-bg, var(--app-accent, #424242));
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0;
}

.app-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.app-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    color: var(--navbar-foreground, var(--app-text, #FFFFFF));
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease-in-out;
}

.app-header-btn:hover,
.app-header-btn:focus {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--navbar-foreground, var(--app-text, #FFFFFF));
}

.app-header-btn:hover i,
.app-header-btn:focus i {
    opacity: 0.8;
}

.app-header-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.app-main {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
}

.app-logo-wrapper {
    text-align: center;
    padding: 1.5rem 0;
}

.app-logo {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
}

.app-logo-fallback {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--app-text, inherit);
}

.app-greeting {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--app-text, inherit);
}

.app-balance {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
}

.app-balance-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.app-balance-amount {
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--app-accent, inherit);
}

.app-coupon-section {
    margin-top: 1rem;
}

.app-coupon-list {
    min-height: 120px;
}

.app-coupon-placeholder {
    color: #6c757d;
}

.app-loading-spinner {
    color: var(--app-accent, #6c757d);
}

/* --- Tarjetas de Cupón --- */

#coupon-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.coupon-card {
    display: flex;
    align-items: stretch;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    -webkit-tap-highlight-color: transparent;
}

.coupon-card:hover,
.coupon-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.coupon-card-logo-wrapper {
    width: 88px;
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background-color: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.coupon-card-logo {
    max-width: 100%;
    max-height: 56px;
    object-fit: contain;
}

.coupon-card-logo-fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
}

.coupon-card-body {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    min-width: 0;
}

.coupon-card-header {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coupon-card-meta {
    font-size: 0.875rem;
    opacity: 0.85;
}

.coupon-card-expiration {
    display: inline-block;
}

.coupon-card-amount {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0.25rem;
}

/* --- Responsive: tarjetas --- */

@media (min-width: 576px) {
    .coupon-card-logo-wrapper {
        width: 112px;
        min-height: 128px;
        padding: 1rem;
    }

    .coupon-card-logo {
        max-height: 72px;
    }

    .coupon-card-body {
        padding: 1.25rem;
    }

    .coupon-card-header {
        font-size: 1.125rem;
    }

    .coupon-card-amount {
        font-size: 1.75rem;
    }
}

/* --- Detalle completo del cupón --- */

.coupon-full {
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: #ffffff;
    color: #212529;
}

.coupon-full-qr-wrapper {
    margin-top: 1.25rem;
    display: flex;
    justify-content: center;
}

.coupon-full-qr {
    max-width: 100%;
    height: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    background-color: #ffffff;
    padding: 0.5rem;
}

.coupon-full-location {
    padding: 0.75rem;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
}

.coupon-full-maps-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--app-accent, #0d6efd);
    text-decoration: none;
}

.coupon-full-maps-link:hover {
    text-decoration: underline;
}

/* --- Modales --- */

.modal-title {
    font-weight: 600;
}

.app-history-table-wrapper {
    max-height: 60vh;
}

.app-history-table {
    margin-bottom: 0;
}

.app-history-table th {
    white-space: nowrap;
    font-weight: 600;
}

.app-history-table td {
    vertical-align: middle;
}

.app-history-amount {
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 575px) {
    .app-history-table-wrapper {
        max-height: 70vh;
    }

    .app-history-table {
        font-size: 0.9rem;
    }
}

/* --- Responsive: escala hasta ~1200px --- */

@media (min-width: 576px) {
    .app-main {
        padding: 1.5rem;
    }

    .app-logo {
        max-width: 220px;
        max-height: 110px;
    }

    .app-greeting {
        font-size: 1.5rem;
    }

    .app-balance-amount {
        font-size: 2.75rem;
    }
}

@media (min-width: 992px) {
    .app-main {
        max-width: 960px;
    }
}

/* --- Perfil --- */

.profile-avatar {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid rgba(0, 0, 0, 0.08);
}

.profile-avatar-fallback {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

#profile-form input[readonly] {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}

/* --- FASE 11: Pulido visual y responsive --- */

/* Header */
.app-header {
    padding: 0.75rem 0;
}

.app-header-inner {
    justify-content: space-around;
    gap: 0.25rem;
}

.app-header-btn {
    min-width: 88px;
    min-height: 44px;
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0.5rem;
    line-height: 1.2;
    text-align: center;
}

.app-header-btn:hover,
.app-header-btn:focus {
    background-color: rgba(0, 0, 0, 0.06);
}

.app-header-btn:focus-visible {
    outline: 2px solid var(--app-accent, #0d6efd);
    outline-offset: 2px;
}

.app-header-btn-disabled {
    pointer-events: none;
}

.app-header-btn i {
    font-size: 1.25rem;
    line-height: 1;
}

/* Logo principal */
.app-logo-wrapper {
    padding: 2rem 0 1.5rem;
}

.app-logo {
    max-width: 160px;
    max-height: 80px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.app-logo-fallback {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Saludo */
.app-greeting {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    line-height: 1.3;
}

/* Saldo */
.app-balance {
    padding: 1.75rem 1rem;
    border-radius: 1rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.06);
}

.app-balance-label {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--app-text, #6c757d);
    opacity: 0.85;
    margin-bottom: 0.75rem;
}

.app-balance-amount {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
}

/* Tarjetas de Cupón */
.coupon-card {
    position: relative;
    min-height: 104px;
    border-radius: 1rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.coupon-card:hover,
.coupon-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.09);
}

.coupon-card:active {
    transform: scale(0.995);
    box-shadow: 0 0.15rem 0.4rem rgba(0, 0, 0, 0.07);
}

.coupon-card:focus-visible {
    outline: 2px solid var(--app-accent, #0d6efd);
    outline-offset: 2px;
}

.coupon-card::after {
    content: "\203A";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.75rem;
    line-height: 1;
    opacity: 0.3;
    pointer-events: none;
    color: currentColor;
}

.coupon-card-body {
    padding-right: 2rem;
}

.coupon-card-header {
    font-size: 1.05rem;
    font-weight: 700;
}

.coupon-card-expiration {
    font-size: 0.85rem;
    opacity: 0.9;
}

.coupon-card-amount {
    font-size: 1.625rem;
    font-weight: 800;
    margin-top: 0.25rem;
}

.coupon-card-logo-wrapper {
    width: 92px;
    min-height: 104px;
}

.coupon-card-logo {
    max-height: 52px;
}

.coupon-card-logo-fallback {
    width: 52px;
    height: 52px;
    font-size: 1.25rem;
}

/* Detalle de Cupón */
.coupon-full {
    border-radius: 0.75rem;
}

.coupon-full-qr-wrapper {
    margin-top: 1.5rem;
    padding: 0.5rem;
    background-color: #ffffff;
    border-radius: 0.75rem;
    display: inline-block;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.06);
}

.coupon-full-qr {
    max-width: 240px;
    width: 100%;
    border: none;
    border-radius: 0.5rem;
    padding: 0;
}

.coupon-full-redeemed {
    background-color: #dc3545;
    color: #ffffff;
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    max-width: 240px;
    margin: 0 auto;
}

.coupon-full-location {
    padding: 1rem;
    border-radius: 0.625rem;
    background-color: #ffffff;
    color: #212529;
    transition: box-shadow 0.12s ease;
    position: relative;
}

.coupon-full-location:hover,
.coupon-full-location:focus-within {
    box-shadow: 0 0.15rem 0.5rem rgba(0, 0, 0, 0.06);
}

.coupon-full-location .coupon-full-maps-link {
    color: #0d6efd;
}

.coupon-full-location .coupon-full-maps-link:hover,
.coupon-full-location .coupon-full-maps-link:focus {
    color: #0a58ca;
}

.coupon-full-maps-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.coupon-full-maps-link::after {
    content: "\2192";
}

.coupon-full-maps-link:hover {
    text-decoration: underline;
}

/* Modales */
.modal-title {
    font-weight: 700;
    font-size: 1.125rem;
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1rem;
}

.modal-body {
    padding: 1rem;
}

/* Historial */
.app-history-table-wrapper {
    max-height: 55vh;
    overflow: auto;
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.app-history-table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.app-history-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #f8f9fa;
}

.app-history-table th,
.app-history-table td {
    padding: 0.75rem 0.75rem;
}

/* Perfil */
#profile-form .profile-avatar,
#profile-form .profile-avatar-fallback {
    width: 96px;
    height: 96px;
    font-size: 2rem;
}

#profile-form .form-label {
    font-weight: 500;
    font-size: 0.9rem;
}

#profile-form .form-control[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

#profile-save-btn,
#profile-logout-btn {
    min-height: 44px;
    font-weight: 600;
    padding: 0.625rem 1rem;
}

/* Loading y estados vacíos */
.app-coupon-placeholder {
    padding: 2.5rem 1rem;
    color: #6c757d;
}

.app-coupon-empty {
    font-size: 0.95rem;
    margin-top: 0.75rem;
}

.app-loading-spinner {
    width: 2rem;
    height: 2rem;
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--app-accent, #0d6efd);
    outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-check-input:focus-visible {
    outline: 2px solid var(--app-accent, #0d6efd);
    outline-offset: 2px;
}

/* Responsive mobile */
@media (max-width: 575px) {
    .modal .modal-dialog {
        max-width: 100%;
        margin: 0;
        min-height: 100vh;
    }

    .modal .modal-dialog .modal-content {
        min-height: 100vh;
        border: none;
        border-radius: 0;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .coupon-full-qr {
        max-width: 280px;
    }
}

/* Responsive tablet y desktop */
@media (min-width: 576px) {
    .app-main {
        padding: 1.5rem;
    }

    .app-logo {
        max-width: 200px;
        max-height: 100px;
    }

    .app-greeting {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .app-balance-amount {
        font-size: 3rem;
    }

    .coupon-card-logo-wrapper {
        width: 120px;
        min-height: 124px;
    }

    .coupon-card-logo {
        max-height: 72px;
    }

    .coupon-card-body {
        padding: 1.25rem 2.25rem 1.25rem 1.25rem;
    }

    .coupon-card-amount {
        font-size: 1.875rem;
    }

    .coupon-full-qr {
        max-width: 300px;
    }
}

@media (min-width: 992px) {
    .app-main {
        max-width: 840px;
        padding: 2rem;
    }

    .modal .modal-dialog {
        max-width: 680px;
    }
}

