/* ═══════════════════════════════════════════
   Tayumi Tools — Shared Styles
   ═══════════════════════════════════════════ */

@import url(https://db.onlinewebfonts.com/c/37f4263992f80d37290a39fa715d574e?family=New+Century+Schoolbook);

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    background: linear-gradient(rgba(250,250,248,0.95), rgba(250,250,248,0.95)), url('../assets/background.jpg') center/cover fixed;
    min-height: 100vh;
}
body {
    background: transparent;
    min-height: 100vh;
    color: #111111;
    font-family: 'New Century Schoolbook', Georgia, serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}
.container { max-width: 1280px; margin: 0 auto; padding: 0 64px; display: flex; flex-direction: column; min-height: 100vh; }
.serif { font-family: 'New Century Schoolbook', Georgia, serif; }
.num {
    font-family: 'New Century Schoolbook', Georgia, serif;
    font-weight: 400;
    font-variant-numeric: lining-nums tabular-nums;
}
.hidden { display: none !important; }

/* ── Nav ── */
.nav {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 100; background: #FFFFFF;
    border-bottom: 1px solid #E8E4DD;
}
.nav-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 64px;
    height: 76px; display: flex; align-items: center; justify-content: space-between;
}
.nav-left { display: flex; align-items: center; gap: 48px; }
.nav-left img { height: 46px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
    font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: #6A6A6A; text-decoration: none; font-weight: 500; transition: color 0.2s;
}
.nav-links a:hover { color: #CEA93D; }
.nav-links a.active,
.nav-links a.parent-active { color: #111111; }
.nav-links a.parent-active::after {
    content: ''; display: inline-block; width: 0; height: 0;
    border-left: 3px solid transparent; border-right: 3px solid transparent;
    border-top: 4px solid #111; margin-left: 4px; vertical-align: middle;
}
.nav-dropdown { position: relative; display: flex; align-items: center; }
.nav-dropdown-menu {
    display: none; position: absolute; top: calc(100% - 6px); left: 50%; transform: translateX(-50%);
    background: #FFF; border: 1px solid #E8E4DD; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08); min-width: 130px;
    z-index: 200; padding: 11px 0 5px; margin-top: 0;
}
.nav-dropdown-menu::before {
    content: ''; position: absolute; top: 0; left: -8px; right: -8px; height: 100%; pointer-events: none;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block; padding: 7px 16px; font-size: .65rem; color: #6A6A6A;
    white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em;
    text-decoration: none; transition: background .15s;
}
.nav-dropdown-menu a:hover { background: #FAFAF8; color: #3E4095; }
.nav-dropdown-menu a.active { color: #111111; background: #F5F3EF; }

/* ── Page Header ── */
.page-header {
    padding-top: 116px; padding-bottom: 32px;
    display: flex; align-items: flex-end; justify-content: space-between;
    border-bottom: 1px solid #E8E4DD;
}
.page-header .breadcrumb {
    font-size: 0.55rem; letter-spacing: 0.15em; text-transform: uppercase;
    color: #8A8A8A; margin-bottom: 4px;
}
.page-header .breadcrumb span { color: #CEA93D; font-weight: 400; }
.page-header h1 {
    font-family: 'New Century Schoolbook', Georgia, serif;
    font-size: 2.6rem; font-weight: 400; color: #111111; letter-spacing: -0.01em;
}
.page-header .subtitle {
    font-size: 0.85rem; color: #5A5A5A; font-weight: 400; margin-top: 4px;
}
.dash-info { text-align: right; }
.dash-info .label {
    font-size: 0.45rem; letter-spacing: 0.18em; text-transform: uppercase; color: #8A8A8A;
}
.dash-info .value { font-size: 0.85rem; color: #111; margin-top: 2px; }

/* ── Cards ── */
.card {
    background: #FFFFFF; border: 1px solid #E8E4DD;
    transition: border-color 0.2s;
}
.card:hover { border-color: #CEA93D; }

/* ── Filter Card ── */
.filter-card {
    background: #FFF; border: 1px solid #EAE7E2; border-radius: 12px; padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
}
.filter-card h3 { font-size: 0.75rem; font-weight: 400; color: #111; letter-spacing: 0.03em; }
.filter-group label {
    display: block; font-size: 0.42rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: #999; font-weight: 400; margin-bottom: 4px;
}
.filter-group input,
.filter-group select {
    width: 100%; background: #F8F7F5; border: 1px solid #EAE7E2; border-radius: 6px;
    padding: 7px 10px; font-size: 0.75rem; color: #111; outline: none; font-family: inherit;
    transition: border-color 0.2s;
}
.filter-group input:focus,
.filter-group select:focus { border-color: #CEA93D; background: #FFF; }
.filter-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23CEA93D' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
.filter-actions { display: flex; flex-direction: column; gap: 6px; }
.btn-primary {
    padding: 9px; background: #CEA93D; color: #FFF; border: none;
    border-radius: 6px; font-size: 0.58rem; font-weight: 400;
    letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; font-family: inherit;
    transition: background 0.2s;
}
.btn-primary:hover { background: #B8942A; }
.btn-primary.gray { background: #8A8A8A; }
.btn-primary.gray:hover { background: #6A6A6A; }

/* ── Stats Row ── */
.stats-row {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1px; background: #E8E4DD; border-radius: 8px; overflow: hidden;
}
.stats-row .card { padding: 12px 10px; text-align: center; background: #FFFFFF; }
.stats-row .metric .num { font-size: 1.2rem; color: #111111; line-height: 1; }
.stats-row .metric .num.gold { color: #CEA93D; }
.stats-row .metric .num.blue { color: #3E4095; }
.stats-row .metric .num.red { color: #B00020; }
.stats-row .metric .lbl {
    font-size: 0.43rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: #6A6A6A; margin-top: 3px; font-weight: 500;
}

/* ── Results Card ── */
.results-card { padding: 20px; border-radius: 12px; }
.results-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.results-title { font-size: 0.9rem; font-weight: 400; color: #111; }
.results-meta { font-size: 0.6rem; color: #8A8A8A; }

/* ── Table ── */
.table-wrap { overflow-x: auto; padding-bottom: 2px; }
.table-wrap::-webkit-scrollbar { height: 5px; }
.table-wrap::-webkit-scrollbar-track { background: #F0EEE8; }
.table-wrap::-webkit-scrollbar-thumb { background: #D8D4CD; border-radius: 3px; }
table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
thead th {
    font-size: 0.5rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: #6A6A6A; font-weight: 500; padding: 8px 10px;
    text-align: left; border-bottom: 1px solid #D8D4CD;
    background: #F5F3EF; white-space: nowrap; cursor: pointer; user-select: none;
}
thead th:hover { color: #111; }
tbody td {
    padding: 8px 10px; color: #111; border-bottom: 1px solid #F0EEE8; font-weight: 400;
}
tbody tr:nth-child(even) { background: #FAFAF8; }
tbody tr:hover { background: #F3F1EB; }
.msg-cell {
    max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer; color: #6A6A6A; font-size: 0.7rem;
}
.msg-expanded {
    max-width: none; white-space: pre-wrap; word-break: break-word;
    background: #F8F6F0; padding: 12px; border-radius: 6px; font-size: 0.7rem; color: #333;
    line-height: 1.5;
}

/* ── Badges ── */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 0.55rem; font-weight: 500; letter-spacing: 0.05em;
}
.badge-hot { background: #FDE8E8; color: #B00020; }
.badge-warm { background: #FEF3E2; color: #B8860B; }
.badge-cold { background: #E8EEF8; color: #3E4095; }
.badge-sim { background: #E8F5E9; color: #2E7D32; }
.badge-nao { background: #FDE8E8; color: #B00020; }

/* ── Pagination ── */
.pagination {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid #F0EEE8;
}
.pagination button {
    padding: 5px 12px; border: 1px solid #E8E4DD; border-radius: 4px;
    background: #FFF; color: #6A6A6A; cursor: pointer; font-family: inherit;
    font-size: 0.65rem; transition: all 0.2s;
}
.pagination button:hover { border-color: #CEA93D; color: #111; }
.pagination button.active { background: #CEA93D; color: #FFF; border-color: #CEA93D; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .info { font-size: 0.6rem; color: #8A8A8A; }

/* ── Loading ── */
.loading { padding: 60px; text-align: center; color: #8A8A8A; font-size: 0.85rem; }
.loading .spinner {
    width: 24px; height: 24px; border: 2px solid #E8E4DD;
    border-top-color: #CEA93D; border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout for sidebar + content ── */
.main-layout { display: flex; gap: 24px; align-items: start; margin: 24px 0; flex: 1; }
.main-layout .side { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.main-layout .content { flex: 1; min-width: 0; }

/* ── Footer ── */
.footer {
    border-top: 1px solid #E8E4DD; margin-top: 40px;
    padding: 32px 0; display: flex; justify-content: space-between; align-items: center;
}
.footer .version { font-size: 0.5rem; letter-spacing: 0.15em; text-transform: uppercase; color: #8A8A8A; }
.footer .copy { font-size: 0.55rem; color: #8A8A8A; }

/* ── User Menu / Dropdown ── */
:root {
    --bg: #FAFAF8;
    --text: #1F2937;
    --card: #FFFFFF;
    --border: #E8E6E3;
    --gold: #C7A22D;
    --blue: #3E4095;
    --text-secondary: #6B7280;
    --hover-bg: #F3F0EB;
}
[data-theme="dark"] {
    --bg: #1a1a2e;
    --text: #e0e0f0;
    --card: #252540;
    --border: #3a3a5c;
    --gold: #d4a843;
    --blue: #6b6fd4;
    --text-secondary: #a0a0c0;
    --hover-bg: #303050;
}
[data-theme="dark"] html { background: linear-gradient(rgba(30,30,60,0.93), rgba(30,30,60,0.93)), url('../assets/background.jpg') center/cover fixed; }
[data-theme="dark"] body { color: var(--text); }
.user-menu { position: relative; }
.user-menu-trigger {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 12px 5px 6px; cursor: pointer;
    font-family: inherit; font-size: 0.72rem; color: var(--text-secondary);
    transition: all 200ms ease;
}
.user-menu-trigger:hover { border-color: var(--gold); background: var(--hover-bg); }
.user-menu-trigger .user-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--gold); color: #FFF;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 500; line-height: 1; flex-shrink: 0;
}
.user-menu-trigger .chevron { transition: transform 200ms ease; color: var(--text-secondary); }
.user-menu-trigger:hover .chevron { color: var(--gold); }
.user-menu-trigger.open .chevron { transform: rotate(180deg); }
.user-greeting { font-weight: 400; line-height: 1; }
.user-greeting strong { font-weight: 500; color: var(--text); }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
    min-width: 180px; padding: 6px; box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: all 200ms ease; z-index: 200;
}
.dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px;
    font-family: inherit; font-size: 0.78rem; color: var(--text);
    background: none; border: none; border-radius: 6px; cursor: pointer;
    text-decoration: none; transition: background 150ms ease;
}
.dropdown-item:hover { background: var(--hover-bg); }
.dropdown-item .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 8px; }
.dropdown-item .toggle-switch {
    margin-left: auto;
    width: 32px; height: 18px; border-radius: 9px;
    background: var(--border); position: relative; transition: background 200ms ease; flex-shrink: 0;
}
.dropdown-item .toggle-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #FFF; transition: transform 200ms ease;
}
.dropdown-item .toggle-switch.on { background: var(--gold); }
.dropdown-item .toggle-switch.on::after { transform: translateX(14px); }

.role-badge {
    font-size: 0.45rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: #CEA93D; border: 1px solid var(--border); padding: 1px 6px; border-radius: 3px;
}

/* ── Scraper Dashboard Specific Pages ── */
.status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.65rem; color: #6A6A6A;
}
.status .dot {
    width: 5px; height: 5px;
    border-radius: 50%; background: #CEA93D;
}

/* ── Dashboard Index ── */
.page-header.torii-header {
    flex-direction: column; align-items: center; text-align: center;
}
.page-header .torii { width: 48px; height: auto; margin-bottom: 16px; }
.page-header .page-sub {
    font-size: 1rem; font-weight: 400; color: #C7A22D;
    letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px;
}
.page-header.torii-header h1 {
    font-size: 2.8rem; font-weight: 400; color: #3E4095; line-height: 1.1;
}
.page-header .page-desc {
    font-size: 0.9rem; color: #6B7280; margin-top: 12px; max-width: 480px;
}
.ornament {
    display: flex; align-items: center; gap: 4px; margin: 24px 0 0;
}
.ornament .line { flex: 1; height: 1px; background: #E8E4DD; }
.ornament .diamond {
    width: 5px; height: 5px; border: 1px solid #CEA93D;
    transform: rotate(45deg); flex-shrink: 0;
}
.ornament .diamond.gold {
    width: 6px; height: 6px; background: #CEA93D; border-color: #CEA93D;
}
.tool-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px;
}
.tool-card {
    background: #FFFFFF; border: 1px solid #E8E4DD; padding: 28px 20px;
    position: relative; transition: all 0.4s ease;
}
.tool-card:hover {
    border-color: #CEA93D; box-shadow: 0 8px 32px rgba(0,0,0,0.05); transform: translateY(-2px);
}
.tool-card::before {
    content: ''; position: absolute; top: -1px; left: 10%; right: 10%;
    height: 2px; background: linear-gradient(90deg, transparent, #CEA93D, transparent);
    opacity: 0; transition: all 0.4s ease;
}
.tool-card:hover::before { opacity: 1; left: 5%; right: 5%; }
.tool-card::after {
    content: ''; position: absolute; top: 16px; right: 20px;
    width: 4px; height: 4px; border: 1px solid #D8D4CD;
    transform: rotate(45deg); opacity: 0.5; transition: all 0.3s ease;
}
.tool-card:hover::after { opacity: 1; border-color: #CEA93D; }
.tool-card .badge {
    display: inline-block; font-size: 0.48rem; letter-spacing: 0.15em;
    text-transform: uppercase; color: #CEA93D; font-weight: 400;
    margin-bottom: 12px; border: 1px solid #E8E4DD; padding: 2px 8px;
}
.tool-card h2 {
    font-family: 'New Century Schoolbook', Georgia, serif;
    font-size: 1.1rem; font-weight: 400; color: #111111; margin-bottom: 8px;
}
.tool-card p {
    font-size: 0.72rem; color: #5A5A5A; line-height: 1.5; margin-bottom: 20px; max-width: 100%;
}
.tool-card .btn-launch {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; border: 1px solid #D8D4CD; color: #111111;
    padding: 8px 20px; font-size: 0.55rem; font-weight: 400;
    letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; cursor: pointer;
    transition: all 0.3s ease; font-family: 'New Century Schoolbook', Georgia, serif;
}
.tool-card .btn-launch:hover {
    border-color: #CEA93D; background: rgba(206,169,61,0.03); color: #CEA93D;
}
.tool-card .btn-launch:hover svg { transform: translateX(4px); }
.tool-card .btn-launch svg { transition: transform 0.3s ease; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .container { padding: 0 32px; }
    .nav-inner { padding: 0 32px; }
    .page-header h1 { font-size: 2rem; }
    .main-layout { flex-direction: column; }
    .main-layout .side { width: 100%; }
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .tool-grid { grid-template-columns: 1fr; }
}
