/* ===== TRIP TRACKING PAGE STYLES ===== */

/* Alert (shared) */
.alloc-alert {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--dash-radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.838rem;
    font-weight: 500;
    animation: dash-fadeUp 0.3s ease-out;
    position: relative;
}

.alloc-alert.show {
    display: flex;
}

.alloc-alert-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.alloc-alert-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.alloc-alert-text {
    flex: 1;
}

.alloc-alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
}

.alloc-alert-close:hover {
    opacity: 1;
}

.alloc-alert-success {
    background: var(--dash-success-light);
    color: var(--dash-success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alloc-alert-error {
    background: var(--dash-danger-light);
    color: var(--dash-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alloc-alert-warning {
    background: var(--dash-warning-light);
    color: var(--dash-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alloc-alert-info {
    background: var(--dash-info-light);
    color: var(--dash-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* --- Stat Cards --- */
.tt-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tt-stat-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    transition: var(--dash-transition);
    overflow: hidden;
    position: relative;
}

.tt-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--dash-radius) var(--dash-radius) 0 0;
}

.tt-stat-card.primary::before {
    background: var(--dash-primary);
}

.tt-stat-card.success::before {
    background: var(--dash-success);
}

.tt-stat-card.warning::before {
    background: var(--dash-warning);
}

.tt-stat-card.info::before {
    background: var(--dash-info);
}

.tt-stat-card.cyan::before {
    background: var(--dash-cyan);
}

.tt-stat-card.violet::before {
    background: var(--dash-violet);
}

.tt-stat-card:hover {
    border-color: var(--dash-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tt-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tt-stat-icon svg {
    width: 20px;
    height: 20px;
}

.tt-stat-icon.primary {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.tt-stat-icon.success {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.tt-stat-icon.warning {
    background: var(--dash-warning-light);
    color: var(--dash-warning);
}

.tt-stat-icon.info {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.tt-stat-icon.cyan {
    background: var(--dash-cyan-light);
    color: var(--dash-cyan);
}

.tt-stat-icon.violet {
    background: var(--dash-violet-light);
    color: var(--dash-violet);
}

.tt-stat-info {
    min-width: 0;
}

.tt-stat-label {
    font-size: 0.688rem;
    font-weight: 600;
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.tt-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dash-text);
    line-height: 1.1;
}

/* --- Filter Bar --- */
.tt-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tt-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 140px;
}

.tt-filter-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tt-filter-select,
.tt-filter-input {
    background: var(--dash-surface-2);
    border: 1.5px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    color: var(--dash-text);
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: var(--dash-transition);
    width: 100%;
}

.tt-filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    cursor: pointer;
}

.tt-filter-select:focus,
.tt-filter-input:focus {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

[data-theme="light"] .tt-filter-select option {
    background: #fff;
    color: #0f172a;
}

/* Search */
.tt-search-wrap {
    position: relative;
    flex: 2;
    min-width: 200px;
}

.tt-search-wrap svg {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--dash-text-muted);
    pointer-events: none;
}

.tt-search-input {
    background: var(--dash-surface-2);
    border: 1.5px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    color: var(--dash-text);
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    outline: none;
    width: 100%;
    transition: var(--dash-transition);
}

.tt-search-input:focus {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

/* Refresh Button */
.tt-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-violet));
    color: white;
    border: none;
    border-radius: var(--dash-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--dash-transition);
    box-shadow: 0 4px 16px var(--dash-primary-glow);
    white-space: nowrap;
    min-height: 36px;
}

.tt-refresh-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.tt-refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tt-refresh-btn svg {
    width: 14px;
    height: 14px;
}

.tt-refresh-btn.spinning svg {
    animation: tt-spin 0.8s linear infinite;
}

@keyframes tt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toolbar counts */
.tt-toolbar-counts {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.tt-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.688rem;
    font-weight: 700;
}

.tt-count-pill.total {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.tt-count-pill.filtered {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

/* --- Table --- */
.tt-table-wrap {
    overflow-x: auto;
    border-radius: var(--dash-radius);
    border: 1px solid var(--dash-border);
}

.tt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.tt-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.tt-table th {
    background: var(--dash-surface-3);
    color: var(--dash-text-muted);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--dash-border);
    white-space: nowrap;
}

.tt-table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--dash-border);
    vertical-align: middle;
}

.tt-table tbody tr {
    transition: background 0.15s ease;
}

.tt-table tbody tr:hover {
    background: var(--dash-primary-light);
}

.tt-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Cell Styles --- */
.tt-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 6px;
    background: var(--dash-surface-3);
    color: var(--dash-text-secondary);
    border-radius: 5px;
    font-size: 0.688rem;
    font-weight: 700;
}

.tt-trip-id {
    font-size: 0.688rem;
    font-weight: 700;
    color: var(--dash-violet);
    background: var(--dash-violet-light);
    padding: 2px 8px;
    border-radius: 5px;
}

.tt-sto-no {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dash-text);
}

.tt-material-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tt-mat-code {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dash-text);
}

.tt-mat-desc {
    font-size: 0.625rem;
    color: var(--dash-text-muted);
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Plant routing */
.tt-plant-cell {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tt-plant-tag {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

.tt-plant-tag.issuing {
    background: var(--dash-warning-light);
    color: var(--dash-warning);
}

.tt-plant-tag.receiving {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.tt-arrow {
    width: 14px;
    height: 14px;
    color: var(--dash-text-muted);
    flex-shrink: 0;
}

.tt-vehicle-badge {
    display: inline-flex;
    padding: 2px 8px;
    background: var(--dash-cyan-light);
    color: var(--dash-cyan);
    border-radius: 5px;
    font-size: 0.688rem;
    font-weight: 700;
}

.tt-driver-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tt-driver-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dash-text);
}

.tt-driver-id {
    font-size: 0.625rem;
    color: var(--dash-text-muted);
}

/* Quantity + progress */
.tt-qty-cell {
    min-width: 110px;
}

.tt-qty-nums {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 4px;
    font-size: 0.75rem;
}

.tt-qty-actual {
    font-weight: 800;
    color: var(--dash-text);
}

.tt-qty-sep {
    color: var(--dash-text-muted);
}

.tt-qty-planned {
    font-weight: 600;
    color: var(--dash-text-muted);
}

.tt-qty-uom {
    font-size: 0.563rem;
    font-weight: 700;
    color: var(--dash-text-muted);
    text-transform: uppercase;
    margin-left: 3px;
}

.tt-progress-bar {
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: var(--dash-surface-3);
    overflow: hidden;
}

.tt-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.tt-progress-fill.low {
    background: var(--dash-danger);
}

.tt-progress-fill.half {
    background: var(--dash-warning);
}

.tt-progress-fill.full {
    background: var(--dash-success);
}

/* Badges */
.tt-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tt-badge-printed {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.tt-badge-pending {
    background: var(--dash-warning-light);
    color: var(--dash-warning);
}

.tt-date {
    font-size: 0.688rem;
    font-weight: 600;
    color: var(--dash-text-secondary);
    white-space: nowrap;
}

/* --- Loading --- */
.tt-loading-overlay {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
}

.tt-loading-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--dash-primary-light);
    border-top-color: var(--dash-primary);
    border-radius: 50%;
    animation: tt-spin 0.8s linear infinite;
}

.tt-loading-text {
    font-size: 0.813rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

/* --- Empty State --- */
.tt-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2rem;
    text-align: center;
}

.tt-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--dash-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.tt-empty-icon svg {
    width: 24px;
    height: 24px;
    color: var(--dash-text-muted);
}

.tt-empty-title {
    font-size: 0.938rem;
    font-weight: 700;
    color: var(--dash-text);
    margin-bottom: 0.25rem;
}

.tt-empty-desc {
    font-size: 0.813rem;
    color: var(--dash-text-muted);
    max-width: 360px;
}

/* Section header */
.tt-section-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--dash-border);
}

.tt-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tt-section-icon svg {
    width: 18px;
    height: 18px;
}

.tt-section-icon.primary {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.tt-section-icon.info {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.tt-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dash-text);
}

.tt-section-subtitle {
    font-size: 0.75rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .tt-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tt-filter-bar {
        flex-direction: column;
    }

    .tt-filter-field {
        min-width: auto;
    }

    .tt-table {
        font-size: 0.688rem;
    }

    .tt-table th,
    .tt-table td {
        padding: 0.5rem;
    }
}