/* CSS Reset & Variables */
:root {
    --bg-color: #0b0c10;
    --sidebar-bg: rgba(15, 17, 26, 0.85);
    --card-bg: rgba(22, 26, 38, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', var(--font-sans);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated spheres */
.bg-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    animation: float 25s infinite alternate ease-in-out;
}

.sphere-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #38bdf8, #8b5cf6);
    top: 10%;
    left: 15%;
}

.sphere-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #ec4899, #8b5cf6);
    bottom: 10%;
    right: 15%;
    animation-delay: -5s;
}

.sphere-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #10b981, #38bdf8);
    top: 50%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -40px) scale(1.1); }
    100% { transform: translate(-30px, 50px) scale(0.9); }
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation Styling */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 35px;
    padding-left: 8px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.brand-text h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

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

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

.nav-item.active {
    color: var(--primary);
    background: var(--primary-glow);
    border-left: 3px solid var(--primary);
}

.badge {
    position: absolute;
    right: 14px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.badge-orange { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-red { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-info h4 {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info span {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 32px 40px;
}

/* Top Header Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.page-title h1 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-title p {
    font-size: 13px;
    color: var(--text-muted);
}

.actions-bar {
    display: flex;
    align-items: center;
    gap: 14px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Card layout & Glassmorphism */
.card {
    border-radius: 16px;
    overflow: hidden;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.card-icon.blue { background: rgba(56, 189, 248, 0.12); color: var(--primary); }
.card-icon.yellow { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.card-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.card-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--purple); }

.card-data .metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-data h3 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    margin: 4px 0;
}

.trend {
    font-size: 11px;
}

.trend.positive { color: var(--success); }
.trend.neutral { color: var(--text-muted); }

/* Dashboard detail rows */
.dashboard-row {
    display: flex;
    gap: 24px;
    margin-bottom: 30px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Status items */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.service-info {
    display: flex;
    flex-direction: column;
}

.service-name {
    font-size: 13px;
    font-weight: 600;
}

.service-port {
    font-size: 11px;
    color: var(--text-muted);
}

.status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

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

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 30px !important;
}

/* Modal Overlay & Container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-container {
    width: 90%;
    max-width: 650px;
    border-radius: 20px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.auth-modal {
    max-width: 400px;
}

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

.modal-header h2, .modal-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all 0.2s ease;
    color-scheme: dark;
}

select.form-input option {
    background-color: #161a26;
    color: #e2e8f0;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

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

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

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon-wrapper input {
    padding-left: 42px;
}

/* Tab panes switching */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Topics Grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.topic-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.topic-card h4 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topic-card p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    flex-grow: 1;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.tag-item {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    color: var(--primary);
}

.topic-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Logs and console view */
.logs-container-card {
    padding: 0;
}

.logs-viewer {
    background: #000;
    color: #00ff00;
    font-family: monospace, Courier, monospace;
    font-size: 12px;
    padding: 20px;
    height: 550px;
    overflow-y: auto;
    border-radius: 16px;
}

.log-line {
    margin-bottom: 6px;
    line-height: 1.4;
}

.log-line.error { color: #ff3333; }
.log-line.warn { color: #ffcc00; }
.log-line.success { color: #00ff00; }
.log-line.time { color: #888888; }

/* Drafts UI: Two columns (Reviewer) */
.drafts-layout {
    display: flex;
    gap: 30px;
}

.draft-panel-left {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.draft-panel-right {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-preview-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.image-preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

.draft-editor-box {
    padding: 20px;
}

.comment-list-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.comment-item h5 {
    font-size: 12px;
    color: var(--primary);
    margin-bottom: 8px;
}

/* Score displays */
.score-row-detail {
    margin-bottom: 12px;
}

.score-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}

.score-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

.score-bar-fill.high { background: var(--success); }
.score-bar-fill.low { background: var(--danger); }

.warning-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fca5a5;
    font-size: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}
