/* AI SEO Agency — Admin Panel
   Design: restrained/minimal, inter-spaced, monochrome + single accent */

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --text: #111111;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #111111;
    --accent-hover: #333333;
    --sidebar-bg: #111111;
    --sidebar-text: #a1a1aa;
    --sidebar-active: #ffffff;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 150ms ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; }
table { border-collapse: collapse; width: 100%; }

/* Layout */
.admin-body {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #ffffff;
    color: #111111;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: -0.02em;
}

.brand-text {
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 450;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.06);
}

.nav-item.active {
    color: var(--sidebar-active);
    background: rgba(255,255,255,0.1);
    font-weight: 500;
}

.nav-item i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    opacity: 0.7;
}

.nav-item.active i { opacity: 1; }

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--sidebar-text);
    font-size: 12px;
}

.logout-link { color: #ef4444 !important; }
.logout-link:hover { background: rgba(239,68,68,0.1) !important; }

/* Main content */
.main-content {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-body {
    padding: 24px 32px;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}

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

/* Tables */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-wrap table {
    width: 100%;
}

.table-wrap th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.table-wrap td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.table-wrap tr:hover td { background: #fafafa; }

.table-wrap td a {
    color: var(--text);
    font-weight: 500;
}

.table-wrap td a:hover { text-decoration: underline; }

.table-actions {
    display: flex;
    gap: 8px;
}

.table-empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover { background: #f5f5f5; }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
    color: #ef4444;
    border-color: #fecaca;
}

.btn-danger:hover { background: #fef2f2; }

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn i { font-size: 14px; }

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: #999999;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

select.form-control { cursor: pointer; }

textarea.form-control { min-height: 100px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar .form-control { max-width: 320px; }

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0;
}

.detail-grid dt {
    padding: 10px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-light);
}

.detail-grid dd {
    padding: 10px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

/* Activity feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

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

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
}

.activity-text { color: var(--text-secondary); }

/* Login page */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.login-brand .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.login-brand .brand-text {
    color: var(--text);
    font-size: 15px;
}

.login-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.login-card .btn-primary { width: 100%; justify-content: center; }

/* Patent search */
.search-results-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.search-result {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.search-result:last-child { border-bottom: none; }

.search-result h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.search-result h3 a:hover { text-decoration: underline; }

.search-result .snippet {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.search-result .snippet mark {
    background: #fef08a;
    color: var(--text);
    padding: 1px 2px;
    border-radius: 2px;
}

.search-result .meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Document viewer */
.doc-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Inter', sans-serif;
}

/* Tool cards */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
}

.tool-card:hover { border-color: #cccccc; }

.tool-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.tool-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.tool-badge-active {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: #ecfdf5;
    color: #059669;
    border-radius: 9999px;
}

.tool-badge-soon {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 9999px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .brand-text,
    .sidebar .nav-item span,
    .sidebar-user span { display: none; }
    .sidebar-brand { justify-content: center; padding: 16px 8px; }
    .nav-item { justify-content: center; padding: 10px; }
    .main-content { margin-left: 60px; }
    .content-header, .content-body { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr 1fr; }
}
