/* =============================================
   BlogRank Pro - Professional CSS
   ============================================= */
:root {
    --bg-primary: #0b1120;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-hover: #1e293b;
    --bg-input: #0f172a;
    --border: #1e3a5f;
    --border-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --rank-gold: #fbbf24;
    --rank-silver: #94a3b8;
    --rank-bronze: #cd7f32;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Auth Pages */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0b1120 0%, #1a1a3e 50%, #0b1120 100%); }
.auth-container { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 40px 32px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { width: 56px; height: 56px; background: linear-gradient(135deg, var(--accent), #8b5cf6); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: #fff; margin-bottom: 16px; }
.auth-logo h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.auth-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.auth-form .form-group { margin-bottom: 20px; }
.auth-form label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-muted); }
.required { color: var(--danger); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
    width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border-light);
    border-radius: 8px; color: var(--text-primary); font-size: 14px; outline: none; transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.sidebar-header .logo-icon { width: 40px; height: 40px; font-size: 16px; flex-shrink: 0; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; }
.sidebar-header small { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-section-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 0 12px; margin-bottom: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-secondary); font-size: 14px; transition: all 0.15s; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(59,130,246,.15); color: var(--accent); }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8b5cf6); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; }
.user-details { flex: 1; min-width: 0; }
.user-details .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .role { font-size: 11px; color: var(--text-muted); }
.main-content { margin-left: 260px; flex: 1; padding: 24px 32px; min-width: 0; }

/* Top Bar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-accent { color: var(--accent); }
.stat-success { color: var(--success); }
.stat-warning { color: var(--warning); }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--bg-input); font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:hover td { background: var(--bg-hover); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Rank Badges */
.rank-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 28px; padding: 0 10px; border-radius: 6px; font-weight: 700; font-size: 13px; }
.rank-1 { background: var(--rank-gold); color: #0f172a; }
.rank-2 { background: var(--rank-silver); color: #0f172a; }
.rank-3 { background: var(--rank-bronze); color: #fff; }
.rank-top10 { background: var(--success); color: #fff; }
.rank-other { background: var(--border-light); color: var(--text-secondary); }
.rank-notfound { background: var(--danger); color: #fff; font-size: 11px; }

/* Tags */
.tag { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-high { background: rgba(239,68,68,.15); color: #fca5a5; }
.tag-medium { background: rgba(245,158,11,.15); color: #fcd34d; }
.tag-low { background: rgba(16,185,129,.15); color: #6ee7b7; }
.tag-admin { background: rgba(139,92,246,.15); color: #c4b5fd; }
.tag-user { background: rgba(59,130,246,.15); color: #93c5fd; }

/* Status */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-completed { background: var(--success); }
.status-processing { background: var(--warning); animation: pulse 1.5s infinite; }
.status-pending { background: var(--text-muted); }
.status-error { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border-light); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Search Box */
.search-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-bottom: 24px; }
.search-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.search-row .form-group { flex: 1; min-width: 180px; margin-bottom: 0; }
.search-row .form-group.small { flex: 0 0 120px; min-width: 120px; }

/* Keyword Stats Inline */
.kw-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.kw-stat { display: flex; flex-direction: column; align-items: center; padding: 12px 16px; background: var(--bg-input); border-radius: 8px; min-width: 100px; }
.kw-stat .kw-stat-value { font-size: 20px; font-weight: 700; }
.kw-stat .kw-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Empty State */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .3; }
.empty-state p { font-size: 14px; }

/* Mobile */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .search-row { flex-direction: column; }
    .search-row .form-group.small { flex: 1; min-width: 100%; }
}
