/* ===================================================================================== */
/* ===== TopNav Limpio — Fondo blanco, textos naranjas, diseño profesional =========== */
/* ===================================================================================== */

#tmTopNav {
    --tm-primary: #ff7b00;
    --tm-primary-2: #ff9d4a;
    --tm-bg: #ffffff;
    --tm-text: #1f2937;
    --tm-border: rgba(255, 123, 0, .15);
}

/* ===== Navbar base ===== */
.tm-topnav {
    background: #ffffff;
    border-bottom: 2px solid var(--tm-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.tm-topnav .container {
    padding-top: .65rem;
    padding-bottom: .65rem;
}

/* ===== Brand / Logo ===== */
.tm-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--tm-primary) !important;
    text-decoration: none;
    letter-spacing: .3px;
    transition: transform .15s ease, opacity .15s ease;
}

.tm-brand:hover {
    transform: scale(1.02);
    opacity: .85;
}

.tm-brand i {
    font-size: 1.4rem;
    color: var(--tm-primary);
}

.tm-brand-text {
    display: inline-flex;
    gap: .15rem;
    color: var(--tm-text);
}

.tm-brand-mx {
    font-weight: 900;
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-2));
    color: #fff;
    padding: .05rem .35rem;
    border-radius: 6px;
    font-size: .95em;
}

/* ===== Toggler (móvil) ===== */
.tm-toggler {
    border: 1px solid var(--tm-border);
    background: transparent;
    padding: .45rem .65rem;
    border-radius: 10px;
    transition: background .15s ease;
}

.tm-toggler:hover,
.tm-toggler:focus {
    background: rgba(255, 123, 0, .05);
    border-color: var(--tm-primary);
}

.tm-toggler-icon i {
    color: var(--tm-primary);
    font-size: 1.1rem;
}

/* ===== Nav Links Principales (Inicio, Estados) ===== */
.tm-nav-main .nav-item {
    margin-right: .25rem;
}

.tm-nav-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--tm-text) !important;
    font-weight: 600;
    padding: .5rem .75rem;
    border-radius: 10px;
    transition: background .15s ease, color .15s ease;
    font-size: .95rem;
}

.tm-nav-link:hover,
.tm-nav-link:focus {
    background: rgba(255, 123, 0, .08);
    color: var(--tm-primary) !important;
}

.tm-nav-link i {
    font-size: 1rem;
    color: var(--tm-primary);
}

/* ===== Nav Actions (derecha) ===== */
.tm-nav-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
}

/* Links rápidos (Mi Negocio, Pedidos, Carrito) */
.tm-nav-quick-link {
    position: relative;
    padding: .5rem .65rem;
}

/* Labels (texto) en links */
.tm-nav-label {
    display: inline;
}

/* ===== Badges (contadores) ===== */
.tm-badge {
    top: 2px;
    right: -2px;
    transform: translate(0,0);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-weight: 800;
    font-size: .7rem;
    display: inline-grid;
    place-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.tm-badge-cart {
    background: #dc3545;
    color: #fff;
    border: 1px solid rgba(220, 53, 69, .3);
}

.nav-badge-orders {
    background: #ffc107;
    color: #1f2937;
    border: 1px solid rgba(255, 193, 7, .3);
}

/* ===== Avatar Usuario ===== */
.tm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-2));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .85rem;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(255, 123, 0, .25);
}

.tm-user-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .6rem .35rem .4rem;
    background: transparent;
    border-radius: 10px;
    border: 1px solid var(--tm-border);
    transition: background .15s ease;
}

.tm-user-toggle:hover {
    background: rgba(255, 123, 0, .05);
    border-color: var(--tm-primary);
}

.tm-user-name {
    color: var(--tm-text);
    font-weight: 600;
    font-size: .9rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Dropdown Menu ===== */
.tm-dropdown-menu {
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
    padding: .4rem;
    margin-top: .5rem;
    min-width: 180px;
}

.tm-dropdown-item {
    border-radius: 8px;
    padding: .5rem .75rem;
    font-weight: 600;
    color: #1f2937;
    transition: background .15s ease;
}

.tm-dropdown-item:hover,
.tm-dropdown-item:focus {
    background: rgba(255,123,0,.08);
    color: var(--tm-primary);
}

.tm-logout {
    color: #dc3545;
}

.tm-logout:hover,
.tm-logout:focus {
    background: rgba(220,53,69,.08);
    color: #dc3545;
}

/* ===== Botones CTA (Crear Cuenta, Registrar Negocio) ===== */
.tm-nav-cta {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .85rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    transition: transform .1s ease, box-shadow .15s ease;
    border: 1px solid transparent;
}

.tm-nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.tm-cta-customer {
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-2));
    color: #fff;
    border-color: var(--tm-primary);
}

.tm-cta-business {
    background: transparent;
    color: #16a34a;
    border: 1px solid rgba(22, 163, 74, .3);
}

.tm-cta-business:hover {
    background: rgba(22, 163, 74, .05);
    color: #16a34a;
}

/* Login link */
.tm-login-link {
    font-weight: 600;
    color: var(--tm-text) !important;
}

.tm-login-link:hover {
    color: var(--tm-primary) !important;
}

/* ===== Responsive: Desktop ===== */
@media (min-width: 992px) {
    .tm-nav-label {
        display: inline;
    }

    .tm-nav-quick-link i {
        font-size: 1.05rem;
    }

    .navbar-collapse {
        flex-basis: auto;
    }
}

/* ===== Responsive: Móvil ===== */
@media (max-width: 991.98px) {
    /* Collapse abierto: fondo con borde */
    .navbar-collapse {
        background: #fff;
        border: 1px solid var(--tm-border);
        border-radius: 12px;
        margin-top: .75rem;
        padding: .75rem;
        box-shadow: 0 4px 18px rgba(0,0,0,.08);
    }

    /* Links en móvil */
    .tm-nav-link {
        color: var(--tm-text) !important;
        padding: .7rem .85rem;
        margin-bottom: .25rem;
        justify-content: flex-start;
    }

    .tm-nav-link:hover {
        background: rgba(255,123,0,.08);
        color: var(--tm-primary) !important;
    }

    .tm-nav-link i {
        font-size: 1.2rem;
        color: var(--tm-primary);
        width: 24px;
        text-align: center;
    }

    /* Link de logout en móvil */
    .tm-logout-mobile {
        color: #dc3545 !important;
    }

    .tm-logout-mobile i {
        color: #dc3545;
    }

    .tm-logout-mobile:hover {
        background: rgba(220,53,69,.08);
        color: #dc3545 !important;
    }

    /* Área táctil grande */
    .tm-nav-quick-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .75rem .85rem;
    }

    .tm-nav-quick-link .tm-badge {
        position: static;
        transform: none;
        margin-left: auto;
    }

    /* Labels visibles */
    .tm-nav-label {
        display: inline;
        color: var(--tm-text);
        font-weight: 600;
    }

    /* Avatar en móvil */
    .tm-user-toggle {
        background: transparent;
        border: 1px solid var(--tm-border);
        padding: .5rem .85rem;
        border-radius: 10px;
        justify-content: flex-start;
        width: 100%;
    }

    .tm-user-toggle:hover {
        background: rgba(255,123,0,.05);
    }

    .tm-user-name {
        color: var(--tm-text);
        max-width: none;
    }

    /* Menú expandible móvil */
    .tm-mobile-user-menu {
        background: rgba(255,123,0,.04);
        border: 1px solid var(--tm-border);
        border-radius: 10px;
        padding: .5rem;
        margin-top: .25rem;
        margin-bottom: .5rem;
        animation: slideDown .2s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .tm-mobile-menu-item {
        display: flex;
        align-items: center;
        padding: .55rem .75rem;
        border-radius: 8px;
        font-weight: 600;
        color: var(--tm-text);
        text-decoration: none;
        transition: background .15s ease;
    }

    .tm-mobile-menu-item:hover,
    .tm-mobile-menu-item:focus {
        background: rgba(255,123,0,.08);
        color: var(--tm-primary);
        text-decoration: none;
    }

    .tm-mobile-menu-item.tm-logout {
        color: #dc3545;
    }

    .tm-mobile-menu-item.tm-logout:hover,
    .tm-mobile-menu-item.tm-logout:focus {
        background: rgba(220,53,69,.08);
        color: #dc3545;
    }

    /* CTAs en móvil: stack vertical */
    .tm-nav-actions {
        flex-direction: column;
        width: 100%;
        gap: .5rem;
        margin-top: .5rem;
        padding-top: .5rem;
        border-top: 1px solid rgba(0,0,0,.08);
    }

    .tm-nav-cta {
        width: 100%;
        justify-content: center;
        padding: .65rem 1rem;
    }

    /* Separador entre secciones */
    .tm-nav-main {
        padding-bottom: .5rem;
        margin-bottom: .5rem;
        border-bottom: 1px solid rgba(0,0,0,.08);
    }
}

/* ===== Responsive: Tablets ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .tm-brand {
        font-size: 1.15rem;
    }

    .tm-brand i {
        font-size: 1.25rem;
    }
}

/* ===== Accesibilidad: focus visible ===== */
.tm-nav-link:focus-visible,
.tm-nav-cta:focus-visible,
.tm-user-toggle:focus-visible {
    outline: 3px solid rgba(255,123,0,.3);
    outline-offset: 2px;
    border-radius: 10px;
}

/* ===== Animación suave del collapse ===== */
.navbar-collapse.collapsing {
    transition: height .25s ease;
}
