/* ============================================================
   MILO PLATFORM — Space Command Center Theme
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep:       #06060e;
    --bg-primary:    #09090b;
    --bg-surface:    #0f1117;
    --bg-card:       #12141d;
    --bg-card-hover: #181b27;
    --bg-input:      #12141d;
    --border:        #1e2030;
    --border-hover:  #2a2d42;
    --text-primary:  #e4e4e7;
    --text-secondary:#9294a6;
    --text-muted:    #5b5d6e;
    --accent-blue:   #3b82f6;
    --accent-green:  #10b981;
    --accent-purple: #8b5cf6;
    --accent-amber:  #f59e0b;
    --accent-red:    #ef4444;
    --accent-cyan:   #06b6d4;
    --glow-blue:     rgba(59, 130, 246, 0.15);
    --glow-green:    rgba(16, 185, 129, 0.15);
    --glow-purple:   rgba(139, 92, 246, 0.15);
    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     14px;
    --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', monospace;
    --sidebar-width: 260px;
    --header-height: 0px;
    --transition:    0.2s ease;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text-secondary); text-decoration: none; }
a:hover { color: var(--text-primary); }
/* removed duplicate hover */

/* --- Animated Starfield (login page) --- */
.starfield {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 0%, #0c0f1a 0%, #06060e 70%);
}
.starfield .star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: drift linear infinite;
    opacity: 0;
}
.starfield .star.large {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 6px 1px rgba(255,255,255,0.3);
}
@keyframes drift {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px;
    background: rgba(15, 17, 23, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    position: relative;
}
.login-card .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fafafa;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}
.login-card .logo span {
    color: var(--text-secondary);
}
.login-card .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* --- Form Elements --- */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b5d6e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
}
.btn-primary:hover { background: rgba(255, 255, 255, 0.14); border-color: #3a3d52; text-decoration: none; }
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-hover); text-decoration: none; }
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-card); text-decoration: none; }

/* --- Layout: Sidebar + Content --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: -0.02em;
}
.sidebar-brand h1 span { color: var(--text-secondary); }
.sidebar-brand .brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.sidebar-nav a:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.sidebar-nav a i { width: 20px; text-align: center; font-size: 0.95rem; }
.sidebar-nav .nav-section {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 20px 14px 8px;
}
.sidebar-user {
    padding: 16px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user .user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 32px;
}
.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: -0.02em;
}
.page-header .page-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}
.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* --- Dashboard App Cards --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
}
.app-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    text-decoration: none;
    color: inherit;
}
.app-card-preview {
    height: 140px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.app-card-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    transition: opacity var(--transition);
}
.app-card:hover .app-card-preview::before { opacity: 0.15; }
.app-card-preview i {
    font-size: 2.5rem;
    opacity: 0.5;
    transition: opacity var(--transition);
}
.app-card:hover .app-card-preview i { opacity: 0.8; }
.app-card-body {
    padding: 18px 20px;
}
.app-card-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #fafafa;
    margin-bottom: 4px;
}
.app-card-body p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.app-card-settings {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    z-index: 2;
    transition: all var(--transition);
    opacity: 0;
}
.app-card:hover .app-card-settings { opacity: 1; }
.app-card-settings:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.app-card .status-dot {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    z-index: 2;
}
.app-card .status-dot.disabled {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.data-table td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.data-table tr:hover td {
    background: var(--bg-card);
}
.data-table .actions {
    display: flex;
    gap: 6px;
}

/* --- Cards / Panels --- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #fafafa;
}

/* --- Badges & Tags --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-admin  { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.badge-user   { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-inactive { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Status badges for dev tracker */
.badge-backlog     { background: rgba(91, 93, 110, 0.2); color: var(--text-muted); }
.badge-open        { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-in_progress { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-done        { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-closed      { background: rgba(91, 93, 110, 0.2); color: var(--text-muted); }

/* Priority badges */
.badge-low      { background: rgba(91, 93, 110, 0.2); color: var(--text-muted); }
.badge-medium   { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-high     { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-critical { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Type badges */
.badge-feature     { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.badge-bug         { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.badge-improvement { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fafafa;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* --- Form Groups --- */
.form-group {
    margin-bottom: 18px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Checkbox pills (for app access) --- */
.checkbox-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.checkbox-pill {
    display: flex;
    align-items: center;
    gap: 6px;
}
.checkbox-pill input[type="checkbox"] {
    display: none;
}
.checkbox-pill label {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 0;
}
.checkbox-pill input:checked + label {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.filter-bar input[type="search"] {
    max-width: 280px;
}
.filter-bar select {
    max-width: 180px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}
.empty-state p {
    font-size: 0.9rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .app-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* --- Utility --- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 16px; }
.hidden { display: none; }
