/* ══════════════════════════════════════════
   Shared Design System
   Font: IBM Plex Sans / IBM Plex Mono
   Theme: Dark + Red (#d32f2f)
   ══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

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

:root {
    --red: #d32f2f;
    --red-hover: #e53935;
    --red-subtle: rgba(211, 47, 47, 0.08);
    --red-glow: rgba(211, 47, 47, 0.15);
    --green: #2ecc71;
    --yellow: #f39c12;
    --bg: #0b0d11;
    --bg-nav: #0f1117;
    --bg-card: #13161d;
    --bg-card-hover: #171b24;
    --bg-input: #0a0c10;
    --border: #1f222c;
    --border-hover: #2a2e3a;
    --text: #eaecf0;
    --text-sub: #8a8f9e;
    --text-muted: #454a58;
}

html, body {
    min-height: 100vh;
    font-family: 'IBM Plex Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ══ Top Navigation ══ */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 28px;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.nav-brand-icon {
    width: 28px;
    height: 28px;
    background: var(--red);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-brand-icon svg {
    width: 16px;
    height: 16px;
}

.nav-brand span {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sub);
    transition: all 0.15s;
}

.nav-links a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.nav-links a.active {
    color: var(--text);
    background: rgba(211, 47, 47, 0.1);
}

.nav-links a.active::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links svg {
    width: 15px;
    height: 15px;
    opacity: 0.6;
}

.nav-links a.active svg {
    opacity: 1;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-user {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 400;
}

.nav-logout {
    padding: 6px 14px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-sub);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.nav-logout:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

/* ══ Page Layout ══ */
.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 36px 28px 60px;
}

.page-header {
    margin-bottom: 32px;
    animation: fadeIn 0.4s ease;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.page-desc {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 400;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ══ Service Tiles ══ */
.services-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-card {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: default;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    animation: tileSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
}

.service-card:nth-child(1) { animation-delay: 0.05s; }
.service-card:nth-child(2) { animation-delay: 0.12s; }
.service-card:nth-child(3) { animation-delay: 0.19s; }
.service-card:nth-child(4) { animation-delay: 0.26s; }
.service-card:nth-child(5) { animation-delay: 0.33s; }
.service-card:nth-child(6) { animation-delay: 0.40s; }

@keyframes tileSlide {
    0% { opacity: 0; transform: translateX(-20px); }
    100% { opacity: 1; transform: translateX(0); }
}

.service-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.service-card.clickable { cursor: pointer; }

.service-card.clickable:hover {
    border-color: rgba(211, 47, 47, 0.4);
    box-shadow: 0 4px 32px rgba(211, 47, 47, 0.08), 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Left accent strip + icon zone */
.card-side {
    width: 72px;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.1) 0%, rgba(211, 47, 47, 0.03) 100%);
    border-right: 1px solid var(--border);
    position: relative;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s;
}

/* Red left edge */
.card-side::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--red);
    opacity: 0.6;
    transition: opacity 0.25s, top 0.3s, bottom 0.3s;
}

.service-card:hover .card-side::before {
    opacity: 1;
    top: 0;
    bottom: 0;
    border-radius: 0;
}

.service-card:hover .card-side {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.14) 0%, rgba(211, 47, 47, 0.05) 100%);
}

.card-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card:hover .card-icon {
    transform: scale(1.1);
}

.card-icon svg {
    width: 22px;
    height: 22px;
    stroke: var(--red);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Right content area */
.card-body-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    gap: 20px;
    min-width: 0;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.4;
}

/* Right-side meta cluster */
.card-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-active .status-dot { background: var(--green); box-shadow: 0 0 6px rgba(46,204,113,0.4); }
.status-active { color: var(--green); }

.status-pending .status-dot { background: var(--yellow); box-shadow: 0 0 6px rgba(243,156,18,0.4); }
.status-pending { color: var(--yellow); }

.status-inactive .status-dot { background: var(--text-muted); }
.status-inactive { color: var(--text-muted); }

.card-port {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.card-action {
    font-size: 13px;
    font-weight: 500;
    color: var(--red);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 7px;
    border: 1px solid rgba(211, 47, 47, 0.2);
    transition: all 0.2s;
}

.card-action:hover {
    background: rgba(211, 47, 47, 0.08);
    border-color: rgba(211, 47, 47, 0.4);
    gap: 8px;
}

.card-action.disabled {
    color: var(--text-muted);
    pointer-events: none;
    border-color: var(--border);
}

/* Legacy compat — hide unused elements */
.card-top, .card-footer { display: none; }

/* ══ Report Sections on Dashboard ══ */
.report-section {
    margin-top: 36px;
    animation: fadeIn 0.4s ease both;
}

.report-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.report-section-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.report-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.report-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.report-entry:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.report-entry-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.report-entry-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.report-entry-icon.icon-patch {
    background: rgba(46, 204, 113, 0.1);
}
.report-entry-icon.icon-patch svg { stroke: var(--green); }

.report-entry-icon.icon-champion {
    background: rgba(88, 166, 255, 0.1);
}
.report-entry-icon.icon-champion svg { stroke: #58a6ff; }

.report-entry-icon.icon-item {
    background: rgba(210, 169, 34, 0.1);
}
.report-entry-icon.icon-item svg { stroke: #d2a922; }

.report-entry-info {
    flex: 1;
    min-width: 0;
}

.report-entry-name {
    font-size: 14px;
    font-weight: 500;
}

.report-entry-date {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'IBM Plex Mono', monospace;
    margin-top: 2px;
}

.report-entry-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.report-entry-preview {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.preview-champ {
    position: relative;
    width: 32px;
    height: 32px;
}

.preview-champ img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
}

.preview-tag {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.tag-buff { background: #22c55e; }
.tag-nerf { background: #ef4444; }
.tag-rework { background: #8b5cf6; }
.tag-adjust { background: #f59e0b; }

.preview-item img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: cover;
}

.report-entry-arrow {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 0.2s;
    align-self: flex-start;
    margin-top: 4px;
}

.report-entry:hover .report-entry-arrow {
    transform: translateX(3px);
    color: var(--text-sub);
}

/* ══ Sub-page Content ══ */
.content-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease both;
}

.content-section:nth-child(2) { animation-delay: 0.08s; }
.content-section:nth-child(3) { animation-delay: 0.16s; }

.section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title svg {
    width: 18px;
    height: 18px;
    stroke: var(--red);
    fill: none;
    stroke-width: 1.8;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 11px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'IBM Plex Mono', monospace;
}

.data-table td {
    color: var(--text-sub);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Stat cards row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    animation: fadeIn 0.4s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'IBM Plex Mono', monospace;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.stat-value.red { color: var(--red); }
.stat-value.green { color: var(--green); }

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    font-family: 'IBM Plex Mono', monospace;
}

.badge-win { background: rgba(46,204,113,0.12); color: var(--green); }
.badge-loss { background: rgba(211,47,47,0.12); color: var(--red); }

/* Bar chart placeholder */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 120px;
    padding-top: 10px;
}

.bar {
    flex: 1;
    background: var(--red-subtle);
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: background 0.2s;
    animation: barGrow 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bar:hover {
    background: var(--red-glow);
}

.bar:nth-child(1) { animation-delay: 0.1s; }
.bar:nth-child(2) { animation-delay: 0.15s; }
.bar:nth-child(3) { animation-delay: 0.2s; }
.bar:nth-child(4) { animation-delay: 0.25s; }
.bar:nth-child(5) { animation-delay: 0.3s; }
.bar:nth-child(6) { animation-delay: 0.35s; }
.bar:nth-child(7) { animation-delay: 0.4s; }

@keyframes barGrow {
    0% { transform: scaleY(0); }
    100% { transform: scaleY(1); }
}

.bar-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 1.2;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* ══ Responsive ══ */
@media (max-width: 768px) {
    .topnav { padding: 0 16px; }
    .nav-links { display: none; }
    .page { padding: 24px 16px 40px; }
    .stats-row { grid-template-columns: 1fr 1fr; }

    .service-card { flex-direction: column; }
    .card-side {
        width: 100%;
        min-height: auto;
        padding: 14px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .card-side::before {
        top: 0; bottom: 0; left: 0;
        width: 100%; height: 3px;
        border-radius: 0;
    }
    .card-body-content {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 20px;
        gap: 12px;
    }
    .card-meta {
        width: 100%;
        justify-content: space-between;
    }
}
