/* ============================================================
   MonitoringCLZ — Google Docs Style
   ============================================================ */

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-hover: #f1f3f4;
  --border: #dadce0;
  --border-hover: #c1c7cd;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: #e8f0fe;
  --success: #1e8e3e;
  --success-light: #e6f4ea;
  --warning: #f57c00;
  --warning-light: #fff3e0;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --vip: #e8eaed;
  --vip-border: #dadce0;
  --vip-text: #3c4043;
  --shadow: 0 1px 2px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.1);
  --shadow-hover: 0 2px 6px rgba(60,64,67,.15), 0 4px 12px rgba(60,64,67,.1);
  --radius: 8px;
  --radius-sm: 4px;
  --font: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 24px 20px 40px; }

/* Header */
.header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.header-left { display: flex; flex-direction: column; gap: 4px; }
.logo { font-size: 1.75rem; font-weight: 500; color: var(--text); letter-spacing: -0.02em; }
.subtitle { font-size: 0.9rem; color: var(--text-secondary); font-weight: 400; }
.header-right { display: flex; align-items: center; }
.stats { display: flex; gap: 24px; font-size: 0.85rem; color: var(--text-secondary); }
.stat strong { color: var(--text); font-weight: 500; margin-right: 4px; }

/* Search */
.search-section { margin-bottom: 28px; }
.search-wrapper { position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.search-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-icon { position: absolute; left: 14px; width: 20px; height: 20px; color: var(--text-muted); pointer-events: none; flex-shrink: 0; }
#search { width: 100%; padding: 12px 52px 12px 48px; border: none; outline: none; background: transparent; font: inherit; font-size: 1rem; color: var(--text); }
#search::placeholder { color: var(--text-muted); }
.clear-btn { position: absolute; right: 10px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; transition: background .15s, color .15s; }
.clear-btn:hover { background: var(--surface-hover); color: var(--text); }
.clear-btn svg { width: 18px; height: 18px; }
.search-hint { margin-top: 8px; font-size: 0.8rem; color: var(--text-muted); }
.search-results-count { margin-top: 8px; font-size: 0.85rem; color: var(--primary); font-weight: 500; }

/* Mandatory Section */
.mandatory-section { margin-bottom: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.mandatory-section .zone-title { padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.mandatory-section .zone-desc { padding: 8px 20px 12px; font-size: 0.8rem; color: var(--text-secondary); }
.table-wrapper { overflow-x: auto; position: relative; }
.mandatory-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.mandatory-table thead th { padding: 10px 0; text-align: center; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); background: #f8f9fa; border-bottom: 2px solid var(--border); white-space: nowrap; }
.mandatory-table th.col-game { width: 260px; min-width: 260px; max-width: 260px; text-align: left; padding: 10px 12px; background: #f8f9fa; position: sticky; left: 0; z-index: 2; border-right: 2px solid var(--border); }
.mandatory-table th.col-pc { width: 44px; min-width: 44px; max-width: 44px; font-weight: 700; background: #f8f9fa; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.mandatory-table tbody tr { border-bottom: 1px solid var(--border); }
.mandatory-table tbody tr:last-child { border-bottom: none; }
.mandatory-table tbody tr:hover { background: var(--surface-hover); }
.mandatory-table tbody th.game-name { padding: 8px 12px; text-align: left; font-weight: 500; font-size: 0.8rem; background: var(--surface); position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--border); white-space: nowrap; min-width: 260px; max-width: 260px; width: 260px; }
.mandatory-table td { padding: 0; text-align: center; vertical-align: middle; width: 44px; min-width: 44px; max-width: 44px; }
.status-cell { width: 100%; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; line-height: 1; border-radius: 0; transition: background .15s; }
.status-cell:hover { background: rgba(0,0,0,.05); transform: none; }
.status-cell.status-installed { background: var(--success-light); color: var(--success); }
.status-cell.status-update { background: var(--warning-light); color: var(--warning); }
.status-cell.status-missing { background: var(--danger-light); color: var(--danger); }
.scan-time-row { padding: 12px 20px; font-size: 0.75rem; color: var(--text-secondary); background: #f8f9fa; border-top: 1px solid var(--border); }

@media (max-width: 768px) {
  .mandatory-table { font-size: 0.7rem; }
  .mandatory-table th.col-game { width: 220px; min-width: 220px; max-width: 220px; }
  .mandatory-table tbody th.game-name { width: 220px; min-width: 220px; max-width: 220px; }
  .mandatory-table th.col-pc { width: 40px; min-width: 40px; max-width: 40px; }
  .mandatory-table td { width: 40px; min-width: 40px; max-width: 40px; }
  .status-cell { height: 32px; font-size: 1.1rem; }
}

/* Zones */
.main { display: flex; flex-direction: column; gap: 32px; }
.zone { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.zone-title { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 1.05rem; font-weight: 500; color: var(--text); }
.zone-icon { font-size: 1.2rem; }
.zone-badge { font-size: 0.75rem; font-weight: 500; padding: 2px 8px; background: var(--primary-light); color: var(--primary); border-radius: 12px; text-transform: uppercase; letter-spacing: 0.03em; margin-left: auto; }
.zone-desc { padding: 8px 20px 12px; font-size: 0.8rem; color: var(--text-secondary); }

/* Tables */
.pc-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.pc-table thead th { text-align: left; padding: 12px 16px; font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); background: #f8f9fa; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pc-table tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
.pc-table tbody tr:last-child { border-bottom: none; }
.pc-table tbody tr:hover { background: var(--surface-hover); }
.pc-table tbody tr.highlight { background: var(--primary-light) !important; }
.pc-table tbody tr.vip-row { background: var(--vip); }
.pc-table tbody tr.vip-row:hover { background: #dde0e3; }
.pc-table td { padding: 12px 16px; vertical-align: top; }

.col-pc { width: 60px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.col-type { width: 100px; }
.col-games { }

/* PC Type Badge */
.pc-type { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 500; padding: 3px 8px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.pc-type.standard { background: var(--primary-light); color: var(--primary); }
.pc-type.vip { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.pc-type.special { background: #f3e5f5; color: #6a1b9a; border: 1px solid #e1bee7; }

/* Games List */
.games-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 20px; }
.game-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; padding: 3px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); transition: border-color .15s, background .15s; white-space: nowrap; }
.game-tag:hover { border-color: var(--primary); background: var(--primary-light); }
.game-tag.matched { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 500; box-shadow: 0 0 0 2px var(--primary-light); }
.game-count { font-size: 0.7rem; color: var(--text-muted); padding: 0 4px; }
.no-games { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }

/* Footer */
.footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; font-size: 0.8rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 16px 12px 32px; }
  .header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .header-right { width: 100%; justify-content: space-between; }
  .stats { gap: 16px; font-size: 0.8rem; }
  .zone-title { flex-wrap: wrap; gap: 8px; }
  .zone-badge { margin-left: 0; margin-top: 4px; }
  .pc-table { display: block; overflow-x: auto; }
  .pc-table thead { display: none; }
  .pc-table tbody { display: block; }
  .pc-table tr { display: block; padding: 16px; border-bottom: 1px solid var(--border); background: var(--surface) !important; }
  .pc-table tr:last-child { border-bottom: none; }
  .pc-table tr:hover { background: var(--surface-hover) !important; }
  .pc-table td { display: flex; justify-content: space-between; align-items: flex-start; padding: 6px 0; border: none; gap: 12px; }
  .pc-table td::before { content: attr(data-label); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
  .pc-table .col-pc { font-size: 1.1rem; font-weight: 500; }
  .pc-table .col-games { align-items: flex-start; }
  .games-list { width: 100%; flex-grow: 1; }
  .mandatory-table { overflow-x: auto; white-space: nowrap; }
  .mandatory-table th.game-name { position: sticky; left: 0; }
  .table-wrapper { overflow-x: auto; }
}

/* Animation */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.zone { animation: fadeIn .3s ease-out backwards; }
.zone:nth-child(1) { animation-delay: 0ms; }
.zone:nth-child(2) { animation-delay: 60ms; }
.zone:nth-child(3) { animation-delay: 120ms; }
.zone:nth-child(4) { animation-delay: 180ms; }
.mandatory-section { animation: fadeIn .3s ease-out; }

.table-wrapper {
    overflow-x: auto;
}

.mandatory-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.mandatory-table tr {
    display: table-row;
}

.mandatory-table td,
.mandatory-table th {
    display: table-cell;
}