/* ============================================================
   TresMotorSports — Portal de Distribuidores (Frontend)
   ============================================================ */

/* -------------------- Login -------------------- */
.tms-distributor-login-wrap {
    max-width: 420px;
    margin: 40px auto;
    padding: 32px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.tms-distributor-login-form h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.tms-distributor-login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.tms-distributor-login-form input[type="text"],
.tms-distributor-login-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.tms-distributor-submit {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background: #1d2327;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    margin-top: 10px;
}

.tms-distributor-submit:hover {
    background: #000;
    color: #fff;
}

.tms-distributor-error {
    background: #fdecea;
    color: #a8261c;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* -------------------- Portal -------------------- */
.tms-portal-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0 60px;
}

.tms-portal-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.tms-portal-welcome {
    font-size: 1.1rem;
    color: #333;
}

.tms-portal-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tms-portal-search {
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    min-width: 260px;
}

.tms-portal-logout {
    padding: 9px 16px;
    background: #f0f0f0;
    color: #333;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.tms-portal-logout:hover {
    background: #e0e0e0;
    color: #000;
}

/* -------------------- Botones de WhatsApp -------------------- */
.tms-portal-whatsapp-general {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: #25D366;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.tms-portal-whatsapp-general:hover {
    background: #1ebe57;
    color: #fff;
}

.tms-portal-whatsapp-general .tms-whatsapp-icon {
    flex-shrink: 0;
}

.tms-col-action {
    text-align: center;
    width: 60px;
}

.tms-portal-whatsapp-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #25D366;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.15s ease;
}

.tms-portal-whatsapp-row:hover {
    background: #1ebe57;
    color: #fff;
}

/* ============================================================
   MATERIAL MULTIMEDIA
   ============================================================ */
.tms-portal-media-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;              /* mismo alto que Cotizar por WhatsApp */
    background: #111;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;            /* que no se parta en dos líneas */
    transition: background 0.15s ease;
}

.tms-portal-media-link:hover {
    background: #333;
    color: #fff;
}

.tms-portal-media-link svg {
    flex-shrink: 0;
}

.tms-media-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0 26px;
}

.tms-media-filter {
    padding: 9px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 40px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tms-media-filter:hover {
    border-color: #111;
}

.tms-media-filter.is-active {
    background: #111;
    border-color: #111;
    color: #fff;
}

.tms-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.tms-media-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.tms-media-card:hover {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
}

.tms-media-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #f2f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tms-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tms-media-ext {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9aa0a6;
}

.tms-media-body {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px 16px 18px;
    flex: 1;
}

.tms-media-cat {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8a8f96;
}

.tms-media-title {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.35;
    font-weight: 700;
    color: #16181c;
}

.tms-media-desc {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #61666d;
}

.tms-media-meta {
    display: flex;
    gap: 10px;
    font-size: 0.74rem;
    color: #8a8f96;
    margin-top: 2px;
}

.tms-media-btn {
    margin-top: auto;
    display: inline-block;
    text-align: center;
    padding: 10px 14px;
    background: #111;
    color: #fff;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.15s ease;
}

.tms-media-btn:hover {
    background: #ff6a13;
    color: #fff;
}

.tms-media-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    padding-top: 4px;
}

.tms-media-actions .tms-media-btn {
    margin-top: 0;
    flex: 1;
}

.tms-media-btn-alt {
    background: #fff;
    color: #16181c;
    border: 1px solid #d8d8d8;
}

.tms-media-btn-alt:hover {
    background: #16181c;
    color: #fff;
    border-color: #16181c;
}

@media (max-width: 640px) {
    .tms-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }
}

/* Botón COMPARTIR de cada fila (reemplaza al de WhatsApp) */
.tms-portal-share-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #111;
    color: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.tms-portal-share-row:hover {
    background: #333;
    transform: translateY(-1px);
}

.tms-portal-share-row:active {
    transform: none;
}

/* Aviso flotante ("Copiado al portapapeles") */
.tms-portal-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 11px 20px;
    background: #111;
    color: #fff;
    font-size: 0.85rem;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.tms-portal-toast[hidden] {
    display: none;
}

.tms-portal-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: #555;
}

/* -------------------- Dashboard de Marcas (filtro inicial) -------------------- */
.tms-brand-dashboard {
    margin-bottom: 26px;
}

.tms-brand-dashboard-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #777;
    margin-bottom: 12px;
    font-weight: 600;
}

.tms-brand-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tms-brand-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 70px;
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tms-brand-tile:hover {
    border-color: #bbb;
}

.tms-brand-tile.is-active {
    border-color: #1d2327;
    box-shadow: 0 0 0 1px #1d2327;
}

.tms-brand-tile img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tms-brand-tile-all {
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
}

/* -------------------- Link al producto en la web -------------------- */
.tms-col-name a {
    color: #1d2327;
    text-decoration: none;
}

.tms-col-name a:hover {
    color: #0073aa;
    text-decoration: underline;
}

.tms-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tms-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.tms-dot-green  { background: #00a32a; }
.tms-dot-yellow { background: #dba617; }
.tms-dot-red    { background: #d63638; }

.tms-portal-group {
    margin-bottom: 28px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
}

.tms-portal-group-header {
    background: #1d2327;
    color: #fff;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tms-portal-group-count {
    font-weight: 400;
    font-size: 0.8rem;
    color: #ccc;
    text-transform: none;
}

.tms-portal-table-scroll {
    overflow-x: auto;
}

.tms-portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.tms-portal-table thead th {
    background: #f7f7f7;
    text-align: left;
    padding: 10px 16px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #666;
    border-bottom: 1px solid #e8e8e8;
}

.tms-portal-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #f2f2f2;
    vertical-align: middle;
}

.tms-portal-table tbody tr:last-child td {
    border-bottom: none;
}

.tms-portal-table tbody tr:hover {
    background: #fafafa;
}

.tms-col-sku {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    white-space: nowrap;
}

.tms-col-price {
    font-weight: 700;
    white-space: nowrap;
}

.tms-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.tms-status-green {
    background: #e6f6ea;
    color: #00a32a;
}

.tms-status-yellow {
    background: #fdf3da;
    color: #9a6700;
}

.tms-status-red {
    background: #fdecea;
    color: #a8261c;
}

.tms-portal-empty,
.tms-portal-no-results {
    text-align: center;
    padding: 40px 0;
    color: #777;
    font-size: 1rem;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 768px) {
    .tms-portal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tms-portal-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .tms-portal-search {
        min-width: 0;
        width: 100%;
    }

    .tms-portal-legend {
        flex-wrap: wrap;
        gap: 12px;
    }

    .tms-brand-tile {
        width: 84px;
        height: 56px;
    }
}
