/* === CSS Variables (Light Mode Default) === */
:root {
  --bg-primary: #f0f2f5;
  --bg-card: #fff;
  --bg-input: #fff;
  --bg-navbar: #1a1a2e;
  --bg-column: #f8fafc;
  --bg-login: linear-gradient(135deg, #f0f2f5 0%, #e2e8f0 50%, #cbd5e1 100%);
  --text-primary: #1a1a2e;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 12px rgba(99,102,241,0.15);
  --shadow-login: 0 20px 60px rgba(0,0,0,0.15);
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-bg: rgba(99,102,241,0.1);
  --badge-bg: #fef3c7;
  --badge-color: #d97706;
  --category-bg: #f1f5f9;
  --category-color: #64748b;
  --pipeline-border: #e2e8f0;
}

/* === Dark Mode === */
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #232735;
  --bg-navbar: #0d0f15;
  --bg-column: #151820;
  --bg-login: linear-gradient(135deg, #0f1117 0%, #1a1d27 50%, #0d1525 100%);
  --text-primary: #e8eaed;
  --text-secondary: #b0b8c4;
  --text-muted: #8892a0;
  --text-light: #5f6b7a;
  --border-color: #2a2f3a;
  --border-light: #1f2430;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 12px rgba(99,102,241,0.25);
  --shadow-login: 0 20px 60px rgba(0,0,0,0.5);
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-bg: rgba(129,140,248,0.15);
  --badge-bg: #3d2e0a;
  --badge-color: #fbbf24;
  --category-bg: #232735;
  --category-color: #8892a0;
  --pipeline-border: #2a2f3a;
}

/* === Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; transition: background 0.3s, color 0.3s; }

/* === Logo Visibility === */
.logo-dark { display: none; }
.logo-light { display: block; }
[data-theme="dark"] .logo-dark { display: block; }
[data-theme="dark"] .logo-light { display: none; }

/* === Login === */
.login-body { background: var(--bg-login); }
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 1rem; }
.login-card { background: var(--bg-card); border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-login); border: 1px solid var(--border-color); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo-img { height: 60px; width: auto; margin-bottom: 1rem; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.login-form { display: flex; flex-direction: column; gap: 1.2rem; }
.login-footer { text-align: center; font-size: 0.75rem; color: var(--text-light); margin-top: 1.5rem; }

/* === Theme Toggle === */
.theme-toggle { background: none; border: 1px solid var(--border-color); cursor: pointer; color: var(--text-light); padding: 0.4rem; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: flex; }
.theme-toggle-login { position: fixed; top: 1rem; right: 1rem; z-index: 100; background: var(--bg-card); }

/* === Forms === */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.input-icon { position: relative; }
.input-icon .material-icons-outlined { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 20px; }
.input-icon input { padding-left: 42px; }
input, select, textarea { width: 100%; padding: 0.7rem 0.9rem; border: 1.5px solid var(--border-color); border-radius: 10px; font-size: 0.9rem; font-family: inherit; transition: border-color 0.2s, background 0.3s; background: var(--bg-input); color: var(--text-primary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* === Buttons === */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.7rem 1.2rem; border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-light); padding: 4px; }
.btn-icon:hover { color: #ef4444; }

/* === Alert === */
.alert { padding: 0.8rem 1rem; border-radius: 10px; font-size: 0.85rem; margin-bottom: 1rem; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
[data-theme="dark"] .alert-error { background: #3b1111; color: #fca5a5; border-color: #5a1d1d; }

/* === Navbar === */
.navbar { background: var(--bg-navbar); padding: 0 1.5rem; height: 60px; display: flex; align-items: center; position: sticky; top: 0; z-index: 100; }
.nav-container { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 1400px; margin: 0 auto; }
.nav-brand { display: flex; align-items: center; text-decoration: none; }
.nav-logo { height: 32px; width: auto; }
.navbar .logo-light { display: none !important; }
.navbar .logo-dark { display: block !important; }
.nav-links { display: flex; align-items: center; gap: 0.5rem; }
.nav-link { color: #94a3b8; text-decoration: none; display: flex; align-items: center; gap: 0.3rem; padding: 0.5rem 0.8rem; border-radius: 8px; font-size: 0.85rem; transition: all 0.2s; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-user { display: flex; align-items: center; gap: 0.3rem; color: #cbd5e1; font-size: 0.85rem; margin-left: 0.5rem; padding-left: 0.5rem; border-left: 1px solid #334155; }
.logout-link { color: #f87171 !important; }
.navbar .theme-toggle { border-color: #334155; color: #94a3b8; }
.navbar .theme-toggle:hover { color: #818cf8; border-color: #818cf8; }

/* === Badges === */
.env-badge { display: inline-block; background: var(--badge-bg); color: var(--badge-color); font-size: 0.75rem; font-weight: 600; padding: 0.3rem 0.8rem; border-radius: 20px; }
.env-badge-sm { font-size: 0.6rem; background: #f59e0b; color: #fff; padding: 0.15rem 0.5rem; border-radius: 10px; }

/* === Main Content === */
.main-content { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.container { width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }

/* === Stats === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border-radius: 14px; padding: 1.2rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-card); border: 1px solid var(--border-light); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon .material-icons-outlined { color: #fff; font-size: 24px; }
.stat-number { font-size: 1.5rem; font-weight: 700; display: block; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* === Section Header === */
.section-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }

/* === Projects Grid === */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.project-card { background: var(--bg-card); border-radius: 14px; padding: 1.2rem; display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; box-shadow: var(--shadow-card); border: 2px solid transparent; transition: all 0.2s; position: relative; }
.project-card:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.project-card-highlight { border: 2px dashed #ef4444; }
.project-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.project-icon .material-icons-outlined { font-size: 26px; }
.project-info h3 { font-size: 0.95rem; font-weight: 600; }
.project-info p { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.project-badge { position: absolute; top: 8px; right: 8px; font-size: 0.65rem; padding: 0.2rem 0.5rem; border: 1.5px dashed; border-radius: 6px; font-weight: 600; }

/* === Quick Actions === */
.quick-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.quick-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; background: var(--bg-card); border-radius: 10px; text-decoration: none; color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; box-shadow: var(--shadow-card); transition: all 0.2s; border: 1px solid var(--border-light); }
.quick-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === Kanban === */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; min-height: 500px; }
.kanban-column { background: var(--bg-column); border-radius: 14px; padding: 0; border: 1px solid var(--border-light); }
.column-header { padding: 1rem; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; border-radius: 14px 14px 0 0; }
.column-header.to-do { background: #fef3c7; color: #d97706; }
.column-header.in-progress { background: #dbeafe; color: #2563eb; }
.column-header.review { background: #ede9fe; color: #7c3aed; }
.column-header.done { background: #d1fae5; color: #059669; }
[data-theme="dark"] .column-header.to-do { background: #3d2e0a; color: #fbbf24; }
[data-theme="dark"] .column-header.in-progress { background: #0c2340; color: #60a5fa; }
[data-theme="dark"] .column-header.review { background: #1e1340; color: #a78bfa; }
[data-theme="dark"] .column-header.done { background: #052e1a; color: #34d399; }
.column-header .count { background: rgba(0,0,0,0.1); padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; margin-left: auto; }
[data-theme="dark"] .column-header .count { background: rgba(255,255,255,0.1); }
.column-body { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; min-height: 200px; }

/* === Pipeline Card === */
.pipeline-card { background: var(--bg-card); border-radius: 10px; padding: 0.8rem; box-shadow: var(--shadow-card); border-left: 3px solid var(--pipeline-border); }
.pipeline-card.priority-high { border-left-color: #f59e0b; }
.pipeline-card.priority-urgent { border-left-color: #ef4444; }
.pipeline-card.priority-medium { border-left-color: #3b82f6; }
.pipeline-card.priority-low { border-left-color: #94a3b8; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.card-project { font-size: 0.7rem; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; }
.priority-dot.priority-urgent { background: #ef4444; }
.priority-dot.priority-high { background: #f59e0b; }
.priority-dot.priority-medium { background: #3b82f6; }
.priority-dot.priority-low { background: #94a3b8; }
.card-task { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; line-height: 1.3; }
.card-category { font-size: 0.7rem; background: var(--category-bg); color: var(--category-color); padding: 0.15rem 0.5rem; border-radius: 6px; display: inline-block; margin-bottom: 0.4rem; }
.card-meta { display: flex; gap: 0.8rem; font-size: 0.7rem; color: var(--text-light); margin-bottom: 0.5rem; }
.card-meta span { display: flex; align-items: center; gap: 0.2rem; }
.card-meta .material-icons-outlined { font-size: 14px; }
.card-actions { display: flex; align-items: center; gap: 0.5rem; }
.status-select { font-size: 0.75rem; padding: 0.3rem 0.5rem; border-radius: 6px; flex: 1; }

/* === Settings === */
.settings-section { background: var(--bg-card); border-radius: 14px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-card); border: 1px solid var(--border-light); }
.settings-section h2 { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-light); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; padding: 0.6rem; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border-light); }
.data-table td { padding: 0.6rem; border-bottom: 1px solid var(--border-light); }
.inline-form { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; }
.inline-form input, .inline-form select { max-width: 180px; }
.role-badge { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 6px; font-weight: 600; }
.role-badge.role-admin { background: #ede9fe; color: #7c3aed; }
.role-badge.role-user { background: var(--category-bg); color: var(--category-color); }
[data-theme="dark"] .role-badge.role-admin { background: #1e1340; color: #a78bfa; }

/* === Modal === */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 200; padding: 1rem; }
[data-theme="dark"] .modal { background: rgba(0,0,0,0.7); }
.modal-content { background: var(--bg-card); border-radius: 16px; padding: 1.5rem; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border-color); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); }

/* === Footer === */
.footer-notice { text-align: center; font-size: 0.75rem; color: var(--text-light); margin-top: 2rem; padding: 1rem; }
.header-actions { display: flex; gap: 0.8rem; align-items: center; }
.select-filter { max-width: 200px; }

/* === Responsive === */
@media (max-width: 768px) {
  .kanban-board { grid-template-columns: 1fr; }
  .nav-text { display: none; }
  .nav-links { gap: 0.2rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; }
  .inline-form { flex-direction: column; }
  .inline-form input, .inline-form select { max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}

/* === Deploy Manager === */
.deploy-status { font-size: 0.7rem; padding: 0.2rem 0.6rem; border-radius: 10px; font-weight: 600; text-transform: uppercase; }
.status-pending { background: var(--badge-bg); color: var(--badge-color); }
.status-created { background: #dbeafe; color: #2563eb; }
.status-nginx_ready { background: #ede9fe; color: #7c3aed; }
.status-deployed { background: #d1fae5; color: #059669; }
.status-error { background: #fef2f2; color: #dc2626; }
[data-theme="dark"] .status-created { background: #0c2340; color: #60a5fa; }
[data-theme="dark"] .status-nginx_ready { background: #1e1340; color: #a78bfa; }
[data-theme="dark"] .status-deployed { background: #052e1a; color: #34d399; }

.deploy-tag { display: inline-block; padding: 0.15rem 0.5rem; background: var(--category-bg); border-radius: 6px; font-size: 0.7rem; }
.tag-green { background: #d1fae5; color: #059669; }
[data-theme="dark"] .tag-green { background: #052e1a; color: #34d399; }

.btn-sm { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.4rem 0.8rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.75rem; color: var(--text-secondary); text-decoration: none; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm .material-icons-outlined { font-size: 16px; }
.btn-sm-danger:hover { border-color: #ef4444; color: #ef4444; }

/* === File Manager === */
.breadcrumb { display: flex; align-items: center; gap: 0.3rem; padding: 0.8rem 1rem; background: var(--bg-card); border-radius: 10px; margin-bottom: 1rem; font-size: 0.85rem; border: 1px solid var(--border-light); }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-muted); }

.file-link { display: flex; align-items: center; gap: 0.4rem; color: var(--text-primary); text-decoration: none; }
.file-link:hover { color: var(--accent); }
.file-link .material-icons-outlined { font-size: 18px; color: var(--accent); }

.code-editor { font-family: 'Courier New', monospace; font-size: 0.8rem; line-height: 1.5; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 10px; padding: 1rem; resize: vertical; tab-size: 2; }

/* === Logs === */
.log-list { display: flex; flex-direction: column; gap: 0.8rem; }
.log-entry { padding: 0.8rem; border-radius: 10px; background: var(--bg-column); border: 1px solid var(--border-light); }
.log-entry.log-error { border-left: 3px solid #ef4444; }
.log-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.log-status .material-icons-outlined { font-size: 18px; }
.log-entry:not(.log-error) .log-status { color: #10b981; }
.log-entry.log-error .log-status { color: #ef4444; }
.log-time { font-size: 0.75rem; color: var(--text-muted); }
.log-cmd { font-size: 0.8rem; margin-bottom: 0.3rem; }
.log-cmd code { background: var(--category-bg); padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
.log-output { font-family: 'Courier New', monospace; font-size: 0.7rem; background: var(--bg-input); padding: 0.5rem; border-radius: 6px; overflow-x: auto; max-height: 150px; overflow-y: auto; color: var(--text-muted); margin-top: 0.3rem; white-space: pre-wrap; word-break: break-all; }

/* === Logo Fixes === */
.login-logo-img { height: 80px; display: block; margin: 0 auto 1rem; }
.login-header .logo-dark { display: none !important; }
.login-header .logo-light { display: block !important; }
[data-theme="dark"] .login-header .logo-dark { display: block !important; }
[data-theme="dark"] .login-header .logo-light { display: none !important; }
.nav-logo { height: 50px; }
