/* Inherit variables from the customer's portal style system */
:root {
    --accent_text: #000000;
    --content_bg: #0080FF;
    --content_text: #000000;
    --content_stroke: #717171;
    --content_stroke2: #bababa;
    --content_stroke3: #fff;
    --accent_bg_tariff: #aaffc614;
    --accent_2: #e0612a;
    --error: #a42f2f;
    --accent_bg: #0080FF;
    --svg_stroke: #fff;
    --menu_bg: #323232;
    --menu_text: #000;
    --menu_stroke: #000;
    --content_icon_bg: #323232;
    --content_icon_stroke: #323232;
    --color_background_button_inner: #2aba90;
    --color_text_button_inner: #fff;
    --color_bckg_button_hover: #101010;
    --bg-main: #fff;

    --black: #000000;
    --white: #ffffff;

    --header: #ffffff;
    --body: #f7f7f7;
    --footer: #464646;

    --text-dark: #464646;
    --text-light: #ffffff;
    --accent: #0E2C62;
    --accent-hover: #143d8a;

    /* Semantic layouts mapping */
    --border-color: #e5e7eb;
    --status-error-bg: #fee2e2;
    --status-error-text: #a42f2f;
    --status-warning-bg: #fef3c7;
    --status-warning-text: #92400e;
    --status-neutral-bg: #f3f4f6;
    --status-neutral-text: #374151;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--body);
    color: var(--text-dark);
    line-height: 1.5;
    padding: 2rem 1rem;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Dashboard Header */
.dashboard-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--white);
}

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    width: 100%;
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

/* Controls (Filters & Search) */
.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
}

.search-wrapper {
    position: relative;
    width: 260px; /* Smaller fixed search! */
    flex: none;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-dark);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dark);
    opacity: 0.5;
    pointer-events: none;
}

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    background-color: var(--body);
    padding: 0.25rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-right: auto; /* Push the 'Заказать' button to the far right! */
}

.filter-tab {
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    border: none;
    background-color: transparent;
    color: var(--text-dark);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.filter-tab.active {
    background-color: var(--accent);
    color: var(--white);
}

.toolbar-order-btn {
    background-color: var(--accent);
    color: var(--white);
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    text-transform: lowercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-plus-icon {
    display: none;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.toolbar-order-btn:hover {
    background-color: var(--accent-hover);
}

/* Date Grouping Layout (Semi-card semi-table) */
.orders-feed {
    padding: 1rem 2rem 2rem 2rem;
}

.date-group {
    margin-bottom: 2rem;
}

.date-group:last-child {
    margin-bottom: 0;
}

.date-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.75rem;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    padding-left: 1.3rem; /* Align perfectly with text inside cards */
}

/* Semi-card row layout */
.order-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.order-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(14, 44, 98, 0.04);
    background-color: rgba(14, 44, 98, 0.005);
}

.order-card.expanded {
    border-color: var(--accent);
    background-color: rgba(14, 44, 98, 0.015);
}

.order-row-grid {
    display: grid;
    grid-template-columns: 240px 1fr 170px; /* 3 Columns: Left Meta (240px), Middle Route (1fr - all free space), Right Price & Status (170px) */
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
}

/* Zone 1: Meta and Class Info */
.meta-zone {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.passenger-name {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: var(--text-dark);
    margin-top: 0.1rem;
    font-weight: 500;
}

.passenger-icon {
    width: 14px;
    height: 14px;
    fill: var(--text-dark);
    opacity: 0.55;
    flex-shrink: 0;
}

.passenger-name span {
    color: var(--accent);
    font-weight: 600;
}

.tariff-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 500;
    width: fit-content;
    border: none;
    background-color: transparent !important;
}

.tariff-name {
    color: #888888 !important; /* Low-contrast grey text */
}

.tariff-car-img {
    height: 24px; /* Larger PNG image! */
    width: auto;
    object-fit: contain;
}

.meta-sub-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-dark);
    opacity: 0.5; /* Low-contrast */
    font-weight: 500;
}

.time-val {
    font-weight: 600;
    color: var(--text-dark);
    opacity: 0.8;
}

/* Zone 2: Route Presentation Stacked */
.route-zone {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.85rem;
}

.route-row {
    color: var(--text-dark);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.route-row.origin {
    font-weight: 500;
}

.route-row.destination {
    color: var(--text-dark);
    font-weight: 500;
}

.route-arrow-char {
    display: inline-block;
    color: var(--accent);
    font-weight: 700;
    margin-right: 0.35rem;
    opacity: 0.7;
}

/* Right Column: Price & Status combined */
.price-status-zone {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    width: 170px;
    flex-shrink: 0;
    text-align: right;
}

.price-zone {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    width: 100%;
    cursor: help; /* Tooltip indicator cursor! */
}

.payment-icon {
    width: 18px;
    height: 18px;
    fill: var(--text-dark);
    opacity: 0.6;
    flex-shrink: 0;
}

.status-zone {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.repeat-btn {
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    background-color: var(--body); /* Native light-grey background */
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    height: 28px;
    text-transform: lowercase;
    transition: all 0.15s ease;
    width: fit-content;
    margin-top: 0.1rem;
}

.repeat-btn:hover {
    background-color: #e5e7eb;
    border-color: #cbd5e1;
    color: var(--accent); /* Accent text on hover */
}

/* Card hover interactions: Swap status with repeat button (Desktop only)! */
@media (min-width: 821px) {
    .order-card:hover .status-zone {
        display: none !important;
    }
    
    .order-card:hover .repeat-btn {
        display: inline-flex !important;
    }
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.status-badge.error {
    background-color: var(--status-error-bg);
    color: var(--status-error-text);
}

.status-badge.neutral {
    background-color: var(--status-neutral-bg);
    color: var(--status-neutral-text);
}

.status-badge.warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.status-badge.success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

/* Expandable Drawer Drawer area inside card */
.details-drawer {
    border-top: 1px dashed var(--border-color);
    background-color: rgba(14, 44, 98, 0.01);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.details-drawer.show {
    max-height: 500px;
    padding: 1.25rem 1.5rem;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.details-route-title {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.details-route-list {
    list-style: none;
    position: relative;
    padding-left: 1.25rem;
}

.details-route-list::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background-color: var(--border-color);
}

.details-route-item {
    position: relative;
    margin-bottom: 0.75rem;
}

.details-route-item:last-child {
    margin-bottom: 0;
}

.details-route-item::before {
    content: "";
    position: absolute;
    left: -19px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent_bg);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--accent_bg);
}

.details-route-item:first-child::before {
    background-color: var(--color_background_button_inner);
    box-shadow: 0 0 0 1px var(--color_background_button_inner);
}

.details-route-item:last-child::before {
    background-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

.details-route-item b {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.details-route-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dark);
    opacity: 0.6;
}

.details-info-panel {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
}

.details-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--body);
}

.details-info-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.details-info-label {
    font-weight: 500;
    opacity: 0.7;
}

.details-info-value {
    font-weight: 600;
    color: var(--accent);
}

.details-link-btn {
    display: inline-block;
    margin-top: 0.75rem;
    text-align: center;
    width: 100%;
    padding: 0.5rem;
    background-color: var(--accent);
    color: var(--white);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.details-link-btn:hover {
    background-color: var(--accent-hover);
}

/* Empty State */
.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-dark);
    opacity: 0.6;
}

/* Additional Services & Expand triggers */
.services-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.service-tag {
    font-size: 0.72rem;
    color: var(--text-dark);
    opacity: 0.8;
    background-color: var(--body);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-weight: 500;
    line-height: 1.2;
}

.expand-trigger-row {
    margin-top: 0.6rem;
    display: flex;
}

.expand-trigger-btn {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
    text-transform: lowercase;
}

.expand-trigger-btn:hover {
    color: var(--accent-hover);
}

/* Mock Map Placeholder */
.mock-map-placeholder {
    height: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    opacity: 0.65;
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: lowercase;
}

.mock-map-placeholder .map-icon {
    width: 36px;
    height: 36px;
    fill: var(--accent);
    opacity: 0.75;
}

/* Responsive Rules */
@media (max-width: 820px) {
    .orders-feed {
        padding: 1rem;
    }
    
    .order-row-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    /* Route (full width, placed at the bottom) */
    .route-zone {
        grid-row: 2;
        grid-column: 1 / span 2;
        border-top: 1px dashed var(--border-color);
        padding-top: 0.75rem;
    }
    
    /* Meta block on the left of the first row */
    .meta-zone {
        grid-row: 1;
        grid-column: 1;
        align-items: flex-start;
    }
    
    /* Price and Status block on the right of the first row */
    .price-status-zone {
        grid-row: 1;
        grid-column: 2;
        align-items: flex-end;
        width: 100%;
    }
    
    /* Always show status and repeat button on mobile */
    .status-zone {
        display: flex !important;
    }
    
    .repeat-btn {
        display: inline-flex !important;
        margin-top: 0.5rem;
    }
    
    .title-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.25rem;
    }
    
    .toolbar-order-btn {
        background-color: var(--status-neutral-bg) !important;
        color: var(--accent) !important;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-text {
        display: none;
    }

    .btn-plus-icon {
        display: block;
        width: 20px;
        height: 20px;
        fill: var(--accent);
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-wrapper {
        min-width: 100%;
    }
    
    .filter-tabs {
        width: 100%;
        overflow-x: auto;
    }
    
    .filter-tab {
        flex: 1;
        text-align: center;
    }
}
