/*
 * Acarmoto visual retrofit
 *
 * Capa de identidad compartida para llevar las pantallas existentes al lenguaje
 * visual definido para la app sin reescribir la lógica de cada módulo.
 * Los CSS específicos de cada módulo siguen resolviendo layout/funcionalidad;
 * esta hoja normaliza color, profundidad, jerarquía y componentes comunes.
 */

:root {
    --brand-red: #ef3340;
    --brand-red-hover: #ff4450;
    --brand-red-soft: rgba(239, 51, 64, 0.14);
    --brand-red-border: rgba(239, 51, 64, 0.34);

    --background-base: #071018;
    --surface-0: #08121b;
    --surface-1: #0b1620;
    --surface-2: #101c27;
    --surface-3: #142431;
    --surface-elevated: #172936;
    --border-subtle: #223541;
    --border-strong: #304956;

    --text-primary: #f5f7f9;
    --text-secondary: #aebdca;
    --text-muted: #718798;

    --status-success: #32b978;
    --status-warning: #e39a37;
    --status-danger: #e75a66;
    --status-info: #4d9dcc;

    --radius-control: 9px;
    --radius-panel: 12px;
    --radius-large: 15px;

    --shadow-panel: 0 18px 50px rgba(0, 0, 0, 0.18);
    --shadow-elevated: 0 20px 60px rgba(0, 0, 0, 0.28);
}

html {
    background: var(--background-base);
}

body {
    background:
        radial-gradient(circle at 72% -10%, rgba(29, 62, 79, 0.16), transparent 32rem),
        linear-gradient(135deg, #071018 0%, #08121a 52%, #061017 100%);
    color: var(--text-primary);
}

::selection {
    background: rgba(239, 51, 64, 0.3);
    color: #fff;
}

* {
    scrollbar-color: #314653 var(--surface-0);
    scrollbar-width: thin;
}

/* --- Shell --- */

.app-shell {
    grid-template-columns: 218px minmax(0, 1fr);
    background:
        radial-gradient(circle at 76% 6%, rgba(22, 49, 64, 0.17), transparent 30rem),
        var(--background-base);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    padding: 28px 16px 170px;
    border-right: 1px solid rgba(66, 91, 105, 0.34);
    background:
        linear-gradient(180deg, rgba(13, 28, 39, 0.98) 0%, rgba(8, 20, 29, 0.99) 62%, rgba(7, 17, 25, 1) 100%);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.12);
    isolation: isolate;
}

.sidebar::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: -60px;
    bottom: 35px;
    width: 250px;
    height: 190px;
    opacity: 0.58;
    background:
        radial-gradient(ellipse at 50% 100%, rgba(42, 70, 82, 0.44), transparent 60%),
        linear-gradient(148deg, transparent 0 38%, rgba(47, 72, 84, 0.42) 39% 40%, transparent 41% 100%),
        linear-gradient(32deg, transparent 0 54%, rgba(35, 58, 70, 0.4) 55% 56%, transparent 57% 100%);
    pointer-events: none;
}

.sidebar::after {
    content: "MOVEMOS MÁS QUE MOTOS";
    position: absolute;
    left: 28px;
    bottom: 62px;
    width: 130px;
    color: rgba(235, 241, 245, 0.78);
    font-size: 0.69rem;
    font-weight: 750;
    letter-spacing: 0.2em;
    line-height: 1.8;
    white-space: normal;
    border-bottom: 2px solid var(--brand-red);
    padding-bottom: 14px;
    pointer-events: none;
}

.product-mark {
    min-height: 52px;
    padding: 0 12px;
    margin-bottom: 28px;
}

.product-mark__logo {
    width: min(132px, 100%);
    max-height: 52px;
    filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.2));
}

.nav-list {
    gap: 7px;
}

.nav-item {
    position: relative;
    min-height: 46px;
    padding: 0 15px 0 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #b8c6d1;
    font-size: 0.88rem;
    font-weight: 640;
    letter-spacing: -0.01em;
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        color 150ms ease,
        transform 150ms ease;
}

.nav-item::before {
    content: "";
    width: 5px;
    height: 5px;
    margin-right: 12px;
    border: 1px solid #6f8798;
    border-radius: 2px;
    transform: rotate(45deg);
    opacity: 0.9;
    flex: 0 0 auto;
}

.nav-item[href]:hover {
    border-color: rgba(72, 98, 112, 0.32);
    background: rgba(18, 35, 46, 0.72);
    color: #fff;
    transform: translateX(1px);
}

.nav-item--active {
    border-color: rgba(239, 51, 64, 0.16);
    background:
        linear-gradient(90deg, rgba(239, 51, 64, 0.24), rgba(239, 51, 64, 0.11));
    color: #fff;
    box-shadow:
        inset 3px 0 0 var(--brand-red),
        0 10px 28px rgba(0, 0, 0, 0.13);
}

.nav-item--active::before {
    border-color: var(--brand-red);
    background: var(--brand-red);
    box-shadow: 0 0 12px rgba(239, 51, 64, 0.65);
}

.nav-item--disabled {
    opacity: 0.48;
}

.workspace {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(9, 20, 29, 0.35), transparent 220px);
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    min-height: 68px;
    padding: 10px clamp(20px, 2.4vw, 34px);
    border-bottom: 1px solid rgba(55, 79, 93, 0.42);
    background: rgba(7, 18, 26, 0.9);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.topbar__identity {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.topbar__context {
    position: relative;
    min-width: 0;
    padding-left: 43px;
}

.topbar__context::before {
    content: "A";
    position: absolute;
    left: 0;
    top: 50%;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #2d4351;
    border-radius: 8px;
    background: linear-gradient(145deg, #152633, #0d1923);
    color: #dce5eb;
    font-size: 0.72rem;
    font-weight: 850;
    transform: translateY(-50%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.topbar__context .eyebrow {
    color: #e8edf1;
    font-size: 0.76rem;
    letter-spacing: 0.01em;
    text-transform: none;
}

.topbar__context-meta {
    color: #718798;
    font-size: 0.7rem;
}

.topbar__context-switch {
    color: #d4dde4;
    font-size: 0.7rem;
    text-decoration: none;
}

.topbar__context-switch:hover {
    color: var(--brand-red-hover);
}

.topbar__user {
    margin: 0;
    padding-left: 18px;
    border-left: 1px solid #233743;
    color: #f3f6f8;
    font-size: 0.84rem;
    white-space: nowrap;
}

.topbar__actions .button {
    min-height: 36px;
    padding-inline: 13px;
    font-size: 0.78rem;
}

.content {
    width: min(100%, 1560px);
    padding: clamp(22px, 2.5vw, 34px);
}

/* --- Typography and hierarchy --- */

.app-shell h1 {
    margin-bottom: 10px;
    color: #f8fafb;
    font-size: clamp(1.9rem, 3.3vw, 2.75rem);
    font-weight: 780;
    letter-spacing: -0.035em;
}

.app-shell h2 {
    color: #f3f6f8;
    font-weight: 740;
    letter-spacing: -0.02em;
}

.app-shell .eyebrow {
    color: #8fa3b2;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
}

.page-header > div > p:last-child,
.payments-header p:last-child,
.service-detail-header > div > p:last-child,
.dashboard-hero > p:last-child {
    max-width: 760px;
    color: #99aebe;
}

/* --- Controls --- */

.button {
    min-height: 42px;
    padding-inline: 16px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 760;
    letter-spacing: -0.01em;
    box-shadow: none;
    transition:
        transform 140ms ease,
        background-color 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease;
}

.button--primary {
    border-color: #f04350;
    background: linear-gradient(180deg, #f43a47, #eb2534);
    color: #fff;
    box-shadow: 0 8px 22px rgba(239, 51, 64, 0.17);
}

.button--primary:hover {
    background: linear-gradient(180deg, #ff4a56, #f52b3a);
    box-shadow: 0 10px 28px rgba(239, 51, 64, 0.25);
    transform: translateY(-1px);
}

.button--secondary {
    border-color: #2a3e4b;
    background: linear-gradient(180deg, #142430, #0f1d27);
    color: #e8eef2;
}

.button--secondary:hover {
    border-color: #405867;
    background: #182b38;
    transform: translateY(-1px);
}

.field label,
.search-bar__label {
    color: #9dafbd;
    font-size: 0.78rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-bar input,
.payment-form input,
.payment-form select,
.payment-form textarea,
.payment-driver-form input,
.payment-driver-form select,
.payment-driver-form textarea,
.payments-resolution input {
    border-color: #283d49;
    background-color: #0b1720;
    color: #f2f6f8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.field input::placeholder,
.field textarea::placeholder,
.search-bar input::placeholder {
    color: #536b7b;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-bar input:hover {
    border-color: #3a5361;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-bar input:focus {
    border-color: rgba(239, 51, 64, 0.72);
    box-shadow: 0 0 0 3px rgba(239, 51, 64, 0.08);
    outline: 0;
}

/* --- Panels/cards shared by existing modules --- */

.welcome-panel,
.info-card,
.placeholder-panel,
.dashboard-section,
.list-panel,
.detail-panel,
.service-form-panel,
.service-summary-card,
.payments-panel,
.payment-row,
.service-balance-row,
.allocation-row,
.payment-attachment,
.payments-empty,
.dashboard-action,
.auth-card {
    border-color: var(--border-subtle);
    background: linear-gradient(145deg, rgba(16, 29, 40, 0.98), rgba(11, 23, 32, 0.98));
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.11);
}

.welcome-panel,
.dashboard-section,
.list-panel,
.detail-panel,
.service-form-panel,
.payments-panel,
.auth-card {
    border-radius: var(--radius-large);
}

.welcome-panel.dashboard-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 210px;
    padding: clamp(28px, 4vw, 44px);
    background:
        radial-gradient(circle at 82% 42%, rgba(239, 51, 64, 0.17), transparent 17rem),
        linear-gradient(110deg, #111f2a 0%, #0c1821 54%, #09141c 100%);
}

.welcome-panel.dashboard-hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -35%;
    right: -5%;
    width: 48%;
    height: 180%;
    opacity: 0.74;
    background:
        linear-gradient(146deg, transparent 0 42%, rgba(239, 51, 64, 0.5) 42.4% 43%, transparent 43.4% 100%),
        linear-gradient(25deg, transparent 0 56%, rgba(66, 91, 105, 0.3) 56.4% 57%, transparent 57.4% 100%),
        radial-gradient(ellipse at 50% 55%, rgba(24, 45, 58, 0.88), transparent 58%);
    transform: skewX(-8deg);
}

.welcome-panel.dashboard-hero::after {
    content: "RUTAS QUE IMPULSAN TU NEGOCIO";
    position: absolute;
    z-index: -1;
    right: clamp(26px, 4vw, 58px);
    bottom: 30px;
    width: 175px;
    color: rgba(235, 241, 245, 0.55);
    font-size: 0.66rem;
    font-weight: 760;
    letter-spacing: 0.22em;
    line-height: 1.75;
}

.info-grid {
    gap: 14px;
}

.info-card {
    position: relative;
    min-height: 112px;
    padding: 20px 22px 18px 74px;
    overflow: hidden;
}

.info-card::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 50%;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(239, 51, 64, 0.33);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(239, 51, 64, 0.34), rgba(239, 51, 64, 0.08) 66%, transparent 68%);
    transform: translateY(-50%);
    box-shadow: inset 0 0 22px rgba(239, 51, 64, 0.08);
}

.info-card__label {
    color: #8297a6;
    font-size: 0.67rem;
    letter-spacing: 0.1em;
}

.info-card strong {
    font-size: 1.15rem;
}

.dashboard-section__header {
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(48, 72, 85, 0.38);
}

.dashboard-action-grid {
    gap: 12px;
}

.dashboard-action {
    min-height: 154px;
    padding: 20px;
    border-radius: 11px;
}

.dashboard-action[href] {
    position: relative;
    overflow: hidden;
}

.dashboard-action[href]::after {
    content: "→";
    position: absolute;
    top: 18px;
    right: 18px;
    color: #6f8798;
    font-size: 1.1rem;
    transition: color 140ms ease, transform 140ms ease;
}

.dashboard-action[href]:hover {
    border-color: rgba(239, 51, 64, 0.36);
    background: linear-gradient(145deg, #142632, #0e1b25);
    transform: translateY(-1px);
}

.dashboard-action[href]:hover::after {
    color: var(--brand-red-hover);
    transform: translateX(2px);
}

.dashboard-action__status {
    color: #718798;
    font-size: 0.64rem;
    letter-spacing: 0.13em;
}

.dashboard-action__link {
    color: #ef4450;
}

.dashboard-action--disabled {
    opacity: 0.62;
}

/* --- Tables/lists --- */

.data-table {
    background: transparent;
}

.data-table th {
    padding-top: 14px;
    padding-bottom: 14px;
    border-bottom-color: #263b48;
    background: rgba(7, 18, 26, 0.42);
    color: #718798;
    font-size: 0.67rem;
    letter-spacing: 0.09em;
}

.data-table td {
    border-bottom-color: rgba(38, 59, 72, 0.62);
    color: #dce5ea;
}

.data-table tbody tr {
    transition: background-color 120ms ease;
}

.data-table tbody tr:hover {
    background: rgba(21, 39, 51, 0.72);
}

.table-link,
.back-link {
    color: #eef3f6;
}

.table-link:hover,
.back-link:hover {
    color: var(--brand-red-hover);
}

.payment-row:hover,
.payment-attachment:hover,
.service-card:hover,
.customer-card:hover {
    border-color: rgba(239, 51, 64, 0.34);
    background: #142430;
}

/* --- Status / feedback --- */

.status-chip,
.payment-status {
    min-height: 27px;
    padding-inline: 10px;
    font-size: 0.7rem;
    font-weight: 760;
}

.status-chip--neutral {
    background: #182630;
    color: #aebdca;
}

.status-chip--success,
.payment-status--confirmed {
    background: rgba(31, 135, 91, 0.19);
    color: #72d8aa;
}

.status-chip--info {
    background: rgba(40, 116, 153, 0.18);
    color: #78bee0;
}

.payment-status--pending {
    background: rgba(172, 103, 24, 0.18);
    color: #efbb70;
}

.payment-status--rejected {
    background: rgba(164, 55, 66, 0.17);
    color: #ef9aa2;
}

.alert {
    border-radius: 10px;
    background: #111f2a;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.11);
}

/* --- Authentication: same identity, less admin-like --- */

.auth-page {
    background:
        radial-gradient(circle at 20% 10%, rgba(239, 51, 64, 0.1), transparent 28rem),
        radial-gradient(circle at 80% 90%, rgba(43, 81, 100, 0.16), transparent 30rem),
        #071018;
}

.auth-card {
    border-color: #263c49;
    background: linear-gradient(145deg, rgba(16, 30, 41, 0.98), rgba(8, 19, 27, 0.99));
    box-shadow: var(--shadow-elevated);
}

/* --- Responsive --- */

@media (max-width: 1199px) {
    .app-shell {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .sidebar {
        padding-inline: 12px;
    }

    .sidebar::after {
        left: 22px;
    }
}

@media (max-width: 767px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        min-height: auto;
        overflow: visible;
        padding: 12px 16px 10px;
        border-right: 0;
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: none;
    }

    .sidebar::before,
    .sidebar::after {
        display: none;
    }

    .product-mark {
        min-height: 40px;
        margin-bottom: 8px;
    }

    .product-mark__logo {
        width: 112px;
        max-height: 38px;
    }

    .nav-list {
        gap: 7px;
    }

    .nav-item {
        min-height: 40px;
        padding-inline: 12px;
        font-size: 0.8rem;
    }

    .nav-item::before {
        display: none;
    }

    .nav-item--active {
        box-shadow: inset 0 -2px 0 var(--brand-red);
    }

    .topbar {
        position: static;
        padding: 12px 16px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .topbar__identity {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .topbar__user {
        padding-left: 43px;
        border-left: 0;
        color: #8ea3b2;
        font-size: 0.75rem;
    }

    .welcome-panel.dashboard-hero {
        min-height: 0;
    }

    .welcome-panel.dashboard-hero::before,
    .welcome-panel.dashboard-hero::after {
        display: none;
    }

    .info-card {
        padding-left: 68px;
    }

    .content {
        padding: 18px 16px 28px;
    }
}

@media (max-width: 420px) {
    .topbar__actions,
    .topbar__actions form,
    .topbar__actions .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .button,
    .nav-item,
    .dashboard-action,
    .dashboard-action[href]::after,
    .data-table tbody tr {
        transition: none;
    }
}
