/* ============================================
   FLEET MANAGER PAGE - RSI HUD Design System
   Based on pages-extra.jsx FleetPage() prototype
   ============================================ */

/* ============================================
   Page Layout
   ============================================ */
.fleet-page {
    position: relative;
    z-index: 1;
    padding: 28px 36px 60px;
    width: 100%;
    animation: hy-fade-in 0.25s ease-out;
}

/* ============================================
   Page Header
   ============================================ */
.fleet-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    animation: hy-fade-up 0.3s ease-out;
}

.fleet-header .header-content {
    flex: 1;
    min-width: 280px;
}

.fleet-kicker {
    font-family: var(--hy-font-mono);
    font-size: 10px;
    color: var(--hy-accent);
    letter-spacing: 0.4em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fleet-kicker::before {
    content: '';
    width: 22px;
    height: 1px;
    background: var(--hy-accent);
}

.fleet-header h1 {
    margin: 0;
    font-family: var(--hy-font-display);
    font-size: 38px;
    font-weight: 400;
    letter-spacing: 0.14em;
    color: var(--hy-ink);
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 18px;
    flex-wrap: wrap;
}

.fleet-header .hyp-page-subtitle {
    font-family: var(--hy-font-mono);
    font-size: 11px;
    color: var(--hy-ink-3);
    letter-spacing: 0.18em;
    margin-top: 8px;
}

.fleet-header .header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Sync buttons */
.fleet-header .sync-btn {
    font-family: var(--hy-font-mono) !important;
    font-size: 11px !important;
    letter-spacing: 0.2em !important;
    padding: 9px 16px !important;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    background: transparent !important;
    border: 1px solid var(--hy-border-soft) !important;
    color: var(--hy-ink-2) !important;
    transition: all 0.15s ease !important;
}

.fleet-header .sync-btn:hover {
    border-color: var(--hy-accent) !important;
    color: var(--hy-ink) !important;
    background: rgba(255, 122, 38, 0.08) !important;
}

/* ============================================
   Stats Row (4 cards)
   ============================================ */
.fleet-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.fleet-stats .hyp-stat-card {
    position: relative;
    padding: 18px 20px;
    background: var(--hy-panel);
    border: 1px solid var(--hy-border-soft);
    backdrop-filter: blur(10px);
    clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.fleet-stats .hyp-stat-card:nth-child(1) { animation: hy-fade-up 0.4s 0ms backwards; }
.fleet-stats .hyp-stat-card:nth-child(2) { animation: hy-fade-up 0.4s 60ms backwards; }
.fleet-stats .hyp-stat-card:nth-child(3) { animation: hy-fade-up 0.4s 120ms backwards; }
.fleet-stats .hyp-stat-card:nth-child(4) { animation: hy-fade-up 0.4s 180ms backwards; }

.fleet-stats .hyp-stat-card:hover {
    border-color: var(--hy-border-strong);
    transform: translateY(-2px);
}

/* Left accent bar */
.fleet-stats .hyp-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--stat-color, var(--hy-accent));
    box-shadow: 0 0 16px color-mix(in srgb, var(--stat-color, var(--hy-accent)) 55%, transparent);
}

/* Icon container */
.fleet-stats .hyp-stat-card .mud-icon-root {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--stat-color, var(--hy-accent)) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--stat-color, var(--hy-accent)) 35%, transparent);
    clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
    font-size: 18px;
    color: var(--stat-color, var(--hy-accent)) !important;
}

.fleet-stats .hyp-stat-card .stat-info {
    display: flex;
    flex-direction: column;
}

.fleet-stats .hyp-stat-card .stat-value {
    font-family: var(--hy-font-display);
    font-size: 30px;
    color: var(--stat-color, var(--hy-accent));
    line-height: 1;
    letter-spacing: 0.04em;
    text-shadow: 0 0 14px color-mix(in srgb, var(--stat-color, var(--hy-accent)) 35%, transparent);
}

.fleet-stats .hyp-stat-card .stat-label {
    font-family: var(--hy-font-mono);
    font-size: 9px;
    color: var(--hy-ink-3);
    letter-spacing: 0.22em;
    margin-top: 6px;
    text-transform: uppercase;
}

/* Stat card color variants */
.fleet-stats .hyp-stat-card:nth-child(1) { --stat-color: #22d3ee; }
.fleet-stats .hyp-stat-card:nth-child(2) { --stat-color: #ef4444; }
.fleet-stats .hyp-stat-card:nth-child(3) { --stat-color: #a78bfa; }
.fleet-stats .hyp-stat-card:nth-child(4) { --stat-color: #fbbf24; }

/* ============================================
   TabBar
   ============================================ */
.fleet-tabs.mud-tabs {
    margin-bottom: 18px;
}

.fleet-tabs .mud-tabs-toolbar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--hy-border-soft);
    background: transparent !important;
    flex-wrap: wrap;
}

.fleet-tabs .mud-tab {
    padding: 10px 18px !important;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--hy-ink-2) !important;
    font-family: var(--hy-font-mono) !important;
    font-size: 11px !important;
    letter-spacing: 0.18em !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.fleet-tabs .mud-tab:hover {
    background: rgba(255, 122, 38, 0.08);
    color: var(--hy-ink) !important;
}

.fleet-tabs .mud-tab.mud-tab-active {
    background: rgba(255, 122, 38, 0.18);
    border-bottom: 2px solid var(--hy-accent);
    color: var(--hy-accent) !important;
    clip-path: polygon(0 6px, 6px 0, 100% 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}

.fleet-tabs .mud-tab .mud-badge {
    padding: 1px 7px;
    background: var(--hy-accent-2);
    color: #000;
    font-size: 9px;
    border-radius: 9px;
    font-weight: 600;
}

/* ============================================
   Filter Bar
   ============================================ */
.fleet-filters {
    display: grid;
    grid-template-columns: 1fr 180px 180px 180px;
    gap: 10px;
    margin-bottom: 16px;
}

.fleet-filters .filter-search {
    width: 100%;
}

.fleet-filters .filter-search .mud-input-control,
.fleet-filters .filter-select .mud-input-control {
    padding: 10px 14px;
    background: var(--hy-panel-hi) !important;
    border: 1px solid var(--hy-border-soft) !important;
    font-family: var(--hy-font-mono);
    font-size: 11px;
    clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}

.fleet-filters .mud-input-control:focus-within {
    border-color: var(--hy-border-strong) !important;
}

.fleet-filters .mud-input {
    color: var(--hy-ink) !important;
}

.fleet-filters .mud-input-label {
    font-family: var(--hy-font-mono) !important;
    font-size: 10px !important;
    letter-spacing: 0.1em !important;
    color: var(--hy-ink-2) !important;
}

/* ============================================
   Page Count
   ============================================ */
.fleet-page .hyp-page-count {
    font-family: var(--hy-font-mono);
    font-size: 10px;
    color: var(--hy-accent);
    letter-spacing: 0.2em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* ============================================
   Fleet Grid (Ship cards)
   ============================================ */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

/* ============================================
   Fleet Card
   ============================================ */
.fleet-card {
    position: relative;
    padding: 16px;
    cursor: pointer;
    background: var(--hy-panel);
    border: 1px solid var(--hy-border-soft);
    backdrop-filter: blur(10px);
    clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
    animation: hy-fade-up 0.3s ease backwards;
    transition: all 0.15s ease;
}

/* Stagger animation */
.fleet-card:nth-child(1) { animation-delay: 0ms; }
.fleet-card:nth-child(2) { animation-delay: 30ms; }
.fleet-card:nth-child(3) { animation-delay: 60ms; }
.fleet-card:nth-child(4) { animation-delay: 90ms; }
.fleet-card:nth-child(5) { animation-delay: 120ms; }
.fleet-card:nth-child(6) { animation-delay: 150ms; }
.fleet-card:nth-child(7) { animation-delay: 180ms; }
.fleet-card:nth-child(8) { animation-delay: 210ms; }
.fleet-card:nth-child(9) { animation-delay: 240ms; }
.fleet-card:nth-child(10) { animation-delay: 270ms; }
.fleet-card:nth-child(n+11) { animation-delay: 300ms; }

.fleet-card:hover {
    border-color: var(--hy-border-strong);
    transform: translateY(-2px);
}

.fleet-card:focus-visible {
    outline: 2px solid var(--hy-accent);
    outline-offset: 2px;
}

/* Owner count badge */
.fleet-card .owner-count {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    background: rgba(34, 211, 238, 0.13);
    border: 1px solid rgba(34, 211, 238, 0.35);
    color: #22d3ee;
    font-family: var(--hy-font-mono);
    font-size: 9px;
    letter-spacing: 0.14em;
    clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.fleet-card .owner-count .mud-icon-root {
    font-size: 12px !important;
}

/* Card image */
.fleet-card-image {
    position: relative;
    height: 90px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hy-border-soft);
    clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
    background: radial-gradient(ellipse at 50% 60%, rgba(34, 211, 238, 0.13) 0%, transparent 70%);
    overflow: hidden;
}

.fleet-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fleet-card-image .image-placeholder {
    color: var(--hy-ink-3);
    opacity: 0.5;
}

/* Card content */
.fleet-card-content {
    display: flex;
    flex-direction: column;
}

.fleet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.fleet-card .manufacturer {
    font-family: var(--hy-font-mono);
    font-size: 9px;
    color: var(--hy-ink-3);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.fleet-card .pad-type {
    font-family: var(--hy-font-mono);
    font-size: 8px;
    padding: 2px 6px;
    border: 1px solid var(--hy-border-soft);
    color: var(--hy-ink-3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.fleet-card .pad-type.pad-xs { color: #94a3b8; border-color: rgba(148, 163, 184, 0.3); }
.fleet-card .pad-type.pad-s { color: #22d3ee; border-color: rgba(34, 211, 238, 0.3); }
.fleet-card .pad-type.pad-m { color: #3ddc84; border-color: rgba(61, 220, 132, 0.3); }
.fleet-card .pad-type.pad-l { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.fleet-card .pad-type.pad-xl { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }

.fleet-card .vehicle-name {
    font-family: var(--hy-font-title);
    font-size: 14px;
    color: var(--hy-ink);
    letter-spacing: 0.06em;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

/* Vehicle roles */
.fleet-card .vehicle-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.fleet-card .vehicle-roles .mud-chip {
    font-family: var(--hy-font-mono) !important;
    font-size: 8px !important;
    letter-spacing: 0.1em !important;
    padding: 2px 8px !important;
    height: auto !important;
    min-height: 0 !important;
}

/* Vehicle specs */
.fleet-card .vehicle-specs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--hy-font-mono);
    font-size: 10px;
    color: var(--hy-ink-2);
    letter-spacing: 0.1em;
}

.fleet-card .vehicle-specs .spec {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fleet-card .vehicle-specs .spec .mud-icon-root {
    font-size: 14px !important;
    color: var(--hy-ink-3) !important;
}

/* ============================================
   Top Vehicles List
   ============================================ */
.top-vehicles-list {
    background: var(--hy-panel);
    border: 1px solid var(--hy-border-soft);
    backdrop-filter: blur(10px);
    clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
    animation: hy-fade-up 0.4s ease-out;
}

.top-vehicle-item {
    display: grid;
    grid-template-columns: 60px 1fr 100px;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hy-border-soft);
    transition: background 0.15s ease;
}

.top-vehicle-item:last-child {
    border-bottom: none;
}

.top-vehicle-item:hover {
    background: rgba(255, 122, 38, 0.05);
}

/* Stagger animation */
.top-vehicle-item:nth-child(1) { animation: hy-fade-up 0.3s 0ms backwards; }
.top-vehicle-item:nth-child(2) { animation: hy-fade-up 0.3s 40ms backwards; }
.top-vehicle-item:nth-child(3) { animation: hy-fade-up 0.3s 80ms backwards; }
.top-vehicle-item:nth-child(4) { animation: hy-fade-up 0.3s 120ms backwards; }
.top-vehicle-item:nth-child(5) { animation: hy-fade-up 0.3s 160ms backwards; }
.top-vehicle-item:nth-child(6) { animation: hy-fade-up 0.3s 200ms backwards; }
.top-vehicle-item:nth-child(7) { animation: hy-fade-up 0.3s 240ms backwards; }
.top-vehicle-item:nth-child(8) { animation: hy-fade-up 0.3s 280ms backwards; }
.top-vehicle-item:nth-child(9) { animation: hy-fade-up 0.3s 320ms backwards; }
.top-vehicle-item:nth-child(10) { animation: hy-fade-up 0.3s 360ms backwards; }

.top-vehicle-item .rank {
    font-family: var(--hy-font-display);
    font-size: 22px;
    color: var(--hy-accent);
    width: 24px;
    text-align: right;
}

.top-vehicle-item .vehicle-image {
    width: 32px;
    height: 32px;
    background: rgba(34, 211, 238, 0.13);
    border: 1px solid rgba(34, 211, 238, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
    overflow: hidden;
}

.top-vehicle-item .vehicle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top-vehicle-item .vehicle-image .mud-icon-root {
    font-size: 16px !important;
    color: #22d3ee !important;
}

.top-vehicle-item .vehicle-info {
    display: flex;
    flex-direction: column;
}

.top-vehicle-item .vehicle-info .vehicle-name {
    font-family: var(--hy-font-title);
    font-size: 13px;
    color: var(--hy-ink);
    letter-spacing: 0.05em;
}

.top-vehicle-item .count {
    padding: 4px 12px;
    background: rgba(255, 122, 38, 0.15);
    border: 1px solid rgba(255, 122, 38, 0.35);
    color: var(--hy-accent);
    font-family: var(--hy-font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-align: center;
    clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.top-vehicle-item .count-value {
    font-weight: 600;
}

.top-vehicle-item .count-label {
    font-size: 8px;
    color: var(--hy-ink-3);
}

/* ============================================
   Stats by Category (Manufacturer/Role bars)
   ============================================ */
.stats-by-category {
    background: var(--hy-panel);
    border: 1px solid var(--hy-border-soft);
    backdrop-filter: blur(10px);
    clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
    padding: 20px;
    animation: hy-fade-up 0.4s ease-out;
}

.category-stat-item {
    display: grid;
    grid-template-columns: 140px 1fr 50px;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.category-stat-item:last-child {
    margin-bottom: 0;
}

/* Stagger animation */
.category-stat-item:nth-child(1) { animation: hy-fade-up 0.4s 0ms backwards; }
.category-stat-item:nth-child(2) { animation: hy-fade-up 0.4s 80ms backwards; }
.category-stat-item:nth-child(3) { animation: hy-fade-up 0.4s 160ms backwards; }
.category-stat-item:nth-child(4) { animation: hy-fade-up 0.4s 240ms backwards; }
.category-stat-item:nth-child(5) { animation: hy-fade-up 0.4s 320ms backwards; }
.category-stat-item:nth-child(6) { animation: hy-fade-up 0.4s 400ms backwards; }
.category-stat-item:nth-child(7) { animation: hy-fade-up 0.4s 480ms backwards; }

.category-stat-item .category-name {
    font-family: var(--hy-font-body);
    font-size: 13px;
    color: var(--hy-ink);
}

.category-stat-item .category-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.category-stat-item .category-bar .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hy-accent), color-mix(in srgb, var(--hy-accent) 70%, transparent));
    box-shadow: 0 0 14px color-mix(in srgb, var(--hy-accent) 50%, transparent);
    transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1.2);
}

/* Role color variants */
.category-stat-item .bar-fill.role-cargo { background: linear-gradient(90deg, #fbbf24, rgba(251, 191, 36, 0.5)); box-shadow: 0 0 14px rgba(251, 191, 36, 0.5); }
.category-stat-item .bar-fill.role-mining { background: linear-gradient(90deg, #22d3ee, rgba(34, 211, 238, 0.5)); box-shadow: 0 0 14px rgba(34, 211, 238, 0.5); }
.category-stat-item .bar-fill.role-medical { background: linear-gradient(90deg, #3ddc84, rgba(61, 220, 132, 0.5)); box-shadow: 0 0 14px rgba(61, 220, 132, 0.5); }
.category-stat-item .bar-fill.role-exploration { background: linear-gradient(90deg, #a78bfa, rgba(167, 139, 250, 0.5)); box-shadow: 0 0 14px rgba(167, 139, 250, 0.5); }
.category-stat-item .bar-fill.role-military { background: linear-gradient(90deg, #ef4444, rgba(239, 68, 68, 0.5)); box-shadow: 0 0 14px rgba(239, 68, 68, 0.5); }
.category-stat-item .bar-fill.role-salvage { background: linear-gradient(90deg, #fb923c, rgba(251, 146, 60, 0.5)); box-shadow: 0 0 14px rgba(251, 146, 60, 0.5); }
.category-stat-item .bar-fill.role-carrier { background: linear-gradient(90deg, #f472b6, rgba(244, 114, 182, 0.5)); box-shadow: 0 0 14px rgba(244, 114, 182, 0.5); }

.category-stat-item .category-count {
    font-family: var(--hy-font-display);
    font-size: 16px;
    color: var(--hy-accent);
    letter-spacing: 0.04em;
    text-align: right;
}

/* ============================================
   Loading State
   ============================================ */
.fleet-page .hyp-page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

/* ============================================
   Empty State
   ============================================ */
.fleet-page .hyp-page-empty {
    padding: 60px 20px;
    text-align: center;
    font-family: var(--hy-font-mono);
    font-size: 12px;
    color: var(--hy-ink-3);
    letter-spacing: 0.15em;
    border: 1px dashed var(--hy-border-soft);
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .fleet-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .fleet-filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .fleet-page {
        padding: 24px 20px 60px;
    }

    .fleet-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .fleet-header h1 {
        font-size: 28px;
    }

    .fleet-header .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .fleet-header .sync-btn {
        width: 100%;
        justify-content: center;
    }

    .fleet-stats {
        grid-template-columns: 1fr;
    }

    .fleet-filters {
        grid-template-columns: 1fr;
    }

    .fleet-grid {
        grid-template-columns: 1fr;
    }

    .top-vehicle-item {
        grid-template-columns: 50px 1fr 80px;
        gap: 10px;
        padding: 10px 12px;
    }

    .top-vehicle-item .rank {
        font-size: 18px;
    }

    .category-stat-item {
        grid-template-columns: 100px 1fr 40px;
        gap: 10px;
    }

    .category-stat-item .category-name {
        font-size: 11px;
    }
}

/* ============================================
   MudBlazor Overrides for Fleet Page
   ============================================ */
.fleet-page .mud-tabs-panels {
    padding-top: 16px;
}

.fleet-page .mud-dialog {
    clip-path: polygon(0 14px, 14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
}

.fleet-page .mud-dialog .mud-dialog-title {
    font-family: var(--hy-font-display);
    letter-spacing: 0.1em;
}
