/* === INDEX.CSS === */

/* === ЗАГОЛОВОК + КНОПКА ОБНОВИТЬ === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dash-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-updated {
    font-size: 12px;
    color: #9ca3af;
}

.btn-refresh {
    width: 32px;
    height: 32px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    padding: 0;
    transition: border-color 0.15s, color 0.15s;
}

.btn-refresh:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-refresh svg   { width: 15px; height: 15px; }

.btn-refresh.spinning svg {
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === СЕТКА ДАШБОРДА === */
.dashboard-cards {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    margin-bottom: 20px;
    align-items: stretch;
}

/* Левая колонка — две карточки друг под другом */
.dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-left .dash-card {
    flex: 1;  /* обе карточки делят высоту поровну */
}

/* === БАЗОВЫЕ СТИЛИ КАРТОЧЕК === */
.dash-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    border-radius: 16px;
    text-decoration: none;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dash-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.18s;
    pointer-events: none;
}

.dash-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.18); color: white; }
.dash-card:hover::after { background: rgba(255,255,255,0.06); }

.dash-card__icon  { width: 34px; height: 34px; margin-bottom: 12px; opacity: 0.85; }
.dash-card__value { font-size: 38px; font-weight: 700; line-height: 1; margin-bottom: 5px; letter-spacing: -1px; }
.dash-card__label { font-size: 13px; font-weight: 500; opacity: 0.88; }
.dash-card__sub   { font-size: 11px; opacity: 0.6; margin-top: 3px; }

/* Цвета */
.dash-card--blue   { background: linear-gradient(140deg, #4f95ff 0%, #1d5fd1 100%); }
.dash-card--green  { background: linear-gradient(140deg, #34d399 0%, #059669 100%); }
.dash-card--orange { background: linear-gradient(140deg, #fbbf24 0%, #d97706 100%); }

/* === ВЫСОКАЯ ОРАНЖЕВАЯ КАРТОЧКА === */
.dash-card--tall {
    justify-content: flex-start;
    align-items: stretch;
    padding: 24px 24px 20px;
    cursor: pointer;
    gap: 0;
}

/* Верхняя часть: иконка + подписи */
.dash-month-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 14px;
}

.dash-month-top .dash-card__icon { margin-bottom: 10px; }

/* Блок месячных цифр */
.dash-month-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 12px 0 6px;
}

.dash-month-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dash-month-stat__value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1;
}

.dash-month-stat__label {
    font-size: 11px;
    opacity: 0.7;
}

.dash-month-stat-sep {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,0.3);
    margin: 0 16px;
    flex-shrink: 0;
}

/* Строка изменения % */
.dash-card__change {
    font-size: 11px;
    opacity: 0.8;
    text-align: center;
    min-height: 15px;
    margin-bottom: 4px;
}

/* Разделитель */
.dash-divider {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.2);
    margin: 12px 0;
    flex-shrink: 0;
}

/* === НЕДЕЛЬНЫЙ СЕЛЕКТОР === */
.dash-week-section { padding: 0; }

.dash-week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.week-day-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    color: rgba(255,255,255,0.65);
    transition: background 0.15s, color 0.15s;
}

.week-day-btn:hover:not([disabled]) {
    background: rgba(255,255,255,0.18);
    color: white;
}

.week-day-btn--today {
    background: rgba(255,255,255,0.92) !important;
    color: #b45309 !important;
}

.week-day-btn--selected {
    background: rgba(255,255,255,0.28);
    color: white;
}

.week-day-btn--future,
.week-day-btn[disabled] {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.week-day-name {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.week-day-num {
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

/* === СТАТИСТИКА ДНЯ === */
.dash-day-section { text-align: center; }

.dash-day-label {
    font-size: 12px;
    opacity: 0.72;
    margin-bottom: 6px;
}

.dash-day-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dash-day-count, .dash-day-revenue {
    font-size: 17px;
    font-weight: 600;
}

.dash-day-sep {
    opacity: 0.4;
    font-size: 18px;
    font-weight: 300;
}

/* === ЛЕНТА ПОСЛЕДНИХ ДЕЙСТВИЙ === */
.activity-feed {
    background: #f8fafc;
    border: 1px solid #e8ecf2;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 4px;
}

.activity-feed__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.activity-feed__title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-feed__link { font-size: 12px; color: #3b82f6; text-decoration: none; }
.activity-feed__link:hover { text-decoration: underline; }
.activity-feed__empty { font-size: 13px; color: #9ca3af; padding: 4px 0; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f4f8;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.activity-body {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-action { font-weight: 600; margin-right: 4px; }
.activity-who    { color: #374151; margin-right: 4px; }
.activity-who::after { content: '·'; color: #d1d5db; margin-left: 4px; }
.activity-detail { color: #6b7280; }
.activity-time   { font-size: 11px; color: #9ca3af; flex-shrink: 0; white-space: nowrap; margin-top: 2px; }

/* === СЕКЦИЯ TECDOC === */
.tecdoc-section {
    background: #f8fafc;
    border: 1px solid #e8ecf2;
    border-radius: 14px;
    padding: 24px 28px;
}

.tecdoc-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.tecdoc-header h2 { margin: 0; font-size: 18px; color: #374151; }
.tecdoc-status { font-size: 13px; color: #6b7280; }

.tecdoc-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
}

.year-input { width: 180px; }

.error-hint {
    color: #dc2626;
    font-size: 12px;
    margin-top: -8px;
    margin-bottom: 12px;
}

.search-input { flex: 1; }

.select-with-btn { display: flex; gap: 8px; align-items: center; flex: 1; }
.select-with-btn select { flex: 1; }

.part-info {
    margin-top: 24px;
    padding: 24px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.part-info h4 { margin-top: 0; margin-bottom: 16px; color: #1a1a2e; font-size: 16px; font-weight: 600; }
.part-info p  { margin: 10px 0; font-size: 14px; color: #4b5563; }
.part-info strong { color: #1a1a2e; }

.part-characteristics { margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5e7eb; }
.part-characteristics h5 { margin-bottom: 12px; color: #1a1a2e; font-size: 15px; font-weight: 600; }
.part-characteristics p  { margin: 8px 0; }

/* === ПОИСК ПО СКЛАДУ (OEM / VIN) === */
.lookup-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}
.lookup-input-row .search-input { flex: 1; }

.lookup-btn { white-space: nowrap; flex-shrink: 0; }

.lookup-results {
    margin-top: 20px;
    padding: 20px 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.lookup-msg { font-size: 14px; color: #4b5563; }
.lookup-msg--error { color: #dc2626; }

.lookup-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 14px;
}

.lookup-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.lookup-table-wrap { overflow-x: auto; }

.lookup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.lookup-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f8fafc;
    color: #6b7280;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.lookup-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f4f8;
    color: #374151;
}
.lookup-table tr:last-child td { border-bottom: none; }

.lookup-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.lookup-badge--active   { background: #d1fae5; color: #065f46; }
.lookup-badge--reserved { background: #fef3c7; color: #92400e; }
.lookup-badge--sold     { background: #fee2e2; color: #991b1b; }
.lookup-badge--scrapped { background: #e5e7eb; color: #374151; }

.lookup-car {
    padding: 16px 0;
    border-bottom: 1px solid #eef1f5;
}
.lookup-car:last-child { border-bottom: none; padding-bottom: 0; }
.lookup-car:first-of-type { padding-top: 0; }

.lookup-car__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.lookup-car__title {
    font-size: 15px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}
.lookup-car__title:hover { text-decoration: underline; }

.lookup-car__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
}
.lookup-car__meta strong { color: #374151; }

.lookup-empty-parts { font-size: 13px; color: #9ca3af; }

/* OEM/VIN-специфика */
.lookup-oem {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    background: #f1f4f8;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    white-space: nowrap;
}

.lookup-veh-filter {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #e8ecf2;
    border-radius: 6px;
    outline: none;
}
.lookup-veh-filter:focus { border-color: #c7d2fe; }
.lookup-vehicles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}
.lookup-veh {
    font-size: 12px;
    color: #374151;
    background: #f8fafc;
    border: 1px solid #e8ecf2;
    border-radius: 6px;
    padding: 4px 10px;
}
.lookup-veh strong { color: #1a1a2e; }

.lookup-warn {
    font-size: 13px;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.lookup-note {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f4f8;
}

/* === АДАПТИВ === */
@media (max-width: 900px) {
    .dashboard-cards      { grid-template-columns: 1fr; }
    .dashboard-left       { flex-direction: row; }
    .tecdoc-form-grid     { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .dashboard-left   { flex-direction: column; }
    .dash-card__value { font-size: 32px; }
    .tecdoc-section   { padding: 16px; }
    .activity-feed    { padding: 14px 16px; }
}
