/* Cassius - RA9 Mission Control Platform */
/* Space Theme with Starfield */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* RA9 Brand Colors */
    --ra9-black: #000000;
    --ra9-white: #FFFFFF;
    --ra9-red: #AA1928;
    --ra9-red-hover: #8a1420;
    --ra9-teal: #7EBEC5;
    --ra9-teal-hover: #6aabb2;
    --ra9-blue: #2EA3F2;

    /* Theme Colors */
    --bg-primary: #000000;
    --bg-secondary: #0a0a12;
    --bg-tertiary: #12121c;
    --bg-hover: #1a1a28;
    --bg-card: rgba(10, 10, 18, 0.85);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #606078;

    /* Accent - RA9 Teal */
    --accent: #7EBEC5;
    --accent-hover: #6aabb2;
    --accent-dim: rgba(126, 190, 197, 0.15);
    --accent-glow: rgba(126, 190, 197, 0.4);

    /* CTA - RA9 Red */
    --cta: #AA1928;
    --cta-hover: #8a1420;
    --cta-dim: rgba(170, 25, 40, 0.15);

    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Borders & Effects */
    --border: rgba(126, 190, 197, 0.2);
    --border-hover: rgba(126, 190, 197, 0.4);
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
    --glow: 0 0 30px rgba(126, 190, 197, 0.3);

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ========================================
   STARFIELD BACKGROUND
   ======================================== */

.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #0a0a18 0%, #000000 100%);
}

.starfield::before,
.starfield::after,
.starfield .stars-layer {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-repeat: repeat;
}

/* Small stars - fast */
.starfield::before {
    background-image:
        radial-gradient(1px 1px at 20px 30px, white, transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 160px 120px, white, transparent),
        radial-gradient(1px 1px at 200px 50px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 220px 140px, white, transparent),
        radial-gradient(1px 1px at 260px 90px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 300px 170px, white, transparent);
    background-size: 320px 200px;
    animation: starMove 80s linear infinite;
    opacity: 0.8;
}

/* Medium stars - medium speed */
.starfield::after {
    background-image:
        radial-gradient(1.5px 1.5px at 150px 50px, #7EBEC5, transparent),
        radial-gradient(1.5px 1.5px at 80px 120px, white, transparent),
        radial-gradient(1.5px 1.5px at 250px 80px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 50px 200px, #7EBEC5, transparent),
        radial-gradient(1.5px 1.5px at 180px 150px, white, transparent),
        radial-gradient(1.5px 1.5px at 320px 30px, rgba(126, 190, 197, 0.8), transparent),
        radial-gradient(1.5px 1.5px at 400px 180px, white, transparent);
    background-size: 450px 220px;
    animation: starMove 120s linear infinite;
    opacity: 0.9;
}

/* Large stars - slow, with glow */
.stars-layer {
    background-image:
        radial-gradient(2px 2px at 100px 100px, #7EBEC5, transparent),
        radial-gradient(2px 2px at 300px 50px, white, transparent),
        radial-gradient(2.5px 2.5px at 200px 180px, rgba(126, 190, 197, 0.9), transparent),
        radial-gradient(2px 2px at 450px 120px, white, transparent),
        radial-gradient(3px 3px at 550px 70px, #7EBEC5, transparent);
    background-size: 600px 250px;
    animation: starMove 200s linear infinite;
}

@keyframes starMove {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

/* Subtle nebula effect */
.starfield .nebula {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(126, 190, 197, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(170, 25, 40, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(46, 163, 242, 0.02) 0%, transparent 60%);
    animation: nebulaPulse 20s ease-in-out infinite alternate;
}

@keyframes nebulaPulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Shooting star effect */
.shooting-star {
    position: absolute;
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, rgba(126, 190, 197, 0.8), transparent);
    animation: shoot 3s ease-out infinite;
    opacity: 0;
}

.shooting-star:nth-child(1) {
    top: 20%;
    left: 80%;
    animation-delay: 0s;
}

.shooting-star:nth-child(2) {
    top: 40%;
    left: 60%;
    animation-delay: 5s;
}

.shooting-star:nth-child(3) {
    top: 10%;
    left: 30%;
    animation-delay: 10s;
}

@keyframes shoot {
    0% {
        transform: translateX(0) translateY(0) rotate(-45deg);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translateX(-300px) translateY(300px) rotate(-45deg);
        opacity: 0;
    }
}

/* ========================================
   LOGIN / AUTH PAGES
   ======================================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow), var(--glow);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 10;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 30px var(--accent-glow);
}

.auth-logo p {
    font-family: var(--font-display);
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Astronaut decoration */
.auth-astronaut {
    position: absolute;
    width: 180px;
    height: auto;
    opacity: 0.15;
    pointer-events: none;
}

.auth-astronaut.left {
    left: -60px;
    top: 50%;
    transform: translateY(-50%) rotate(-15deg);
}

.auth-astronaut.right {
    right: -60px;
    bottom: 20%;
    transform: rotate(15deg);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px var(--accent-dim);
    background: rgba(0, 0, 0, 0.6);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--cta);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(170, 25, 40, 0.3);
}

.btn-primary:hover {
    background: var(--cta-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(170, 25, 40, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    width: 100%;
}

.btn-secondary:hover {
    background: var(--accent-dim);
    box-shadow: 0 0 20px var(--accent-dim);
}

.btn-teal {
    background: var(--accent);
    color: var(--ra9-black);
    width: 100%;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-teal:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--accent-glow);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

.dashboard {
    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;
    height: 100vh;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.sidebar-header .tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 8px 20px;
    font-family: var(--font-display);
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 0.9rem;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-right: 3px solid var(--accent);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    opacity: 0.8;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--ra9-teal-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ra9-black);
}

.user-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-crown {
    flex-shrink: 0;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5));
}

.logout-btn {
    padding: 6px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(170, 25, 40, 0.15);
    border-color: var(--red);
    color: var(--red);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    position: relative;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.page-header p {
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    box-shadow: var(--glow);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--accent);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-change {
    font-size: 0.85rem;
    margin-top: 8px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--error); }

/* ========================================
   CHAT WIDGET
   ======================================== */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cta), #cc2030);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 25px rgba(170, 25, 40, 0.5);
    transition: all 0.3s ease;
}

.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 35px rgba(170, 25, 40, 0.6);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
}

.chat-panel {
    position: absolute;
    bottom: 84px;
    right: 0;
    width: 420px;
    height: 620px;
    max-height: calc(100vh - 120px);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), 0 0 40px rgba(126, 190, 197, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-panel.open {
    display: flex;
}

.chat-panel.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    z-index: 10001;
}

.chat-widget.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
}

.chat-widget.fullscreen .chat-toggle {
    display: none;
}

.chat-panel.fullscreen .chat-messages {
    padding: 30px 15%;
}

.chat-panel.fullscreen .message {
    max-width: 70%;
}

.chat-panel.fullscreen .chat-input-area {
    padding: 20px 15%;
}

@media (max-width: 768px) {
    .chat-panel.fullscreen .chat-messages,
    .chat-panel.fullscreen .chat-input-area {
        padding-left: 20px;
        padding-right: 20px;
    }
    .chat-panel.fullscreen .message {
        max-width: 90%;
    }
}

.chat-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
}

.chat-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 1px;
}

.chat-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.chat-fullscreen,
.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.chat-fullscreen:hover,
.chat-close:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1.6;
}

.message.user {
    background: linear-gradient(135deg, var(--cta), #cc2030);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 15px rgba(170, 25, 40, 0.3);
}

.message.assistant {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.message.typing {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat action buttons */
.chat-action-btn {
    display: inline-block;
    padding: 10px 16px;
    margin: 6px 6px 6px 0;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 24px;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-action-btn:hover {
    background: var(--accent);
    color: var(--ra9-black);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.chat-link {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.chat-link:hover {
    text-decoration: underline;
    text-shadow: 0 0 10px var(--accent-glow);
}

.tool-call {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--success);
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.chat-input-area {
    padding: 18px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    padding: 14px 18px;
    background: var(--cta);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-send:hover {
    background: var(--cta-hover);
    transform: scale(1.05);
}

.chat-send svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
}

.quick-action {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* ========================================
   NINJA ONE WIDGETS
   ======================================== */

.ninja-widget {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 12px;
    font-size: 0.85rem;
}

.ninja-widget.ninja-success {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.ninja-widget.ninja-error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.ninja-widget-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.5px;
}

.ninja-mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.ninja-mini-stat {
    text-align: center;
    padding: 10px 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.ninja-mini-stat .stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ninja-mini-stat .stat-value.online { color: var(--success); }
.ninja-mini-stat .stat-value.offline { color: var(--error); }
.ninja-mini-stat .stat-value.critical { color: var(--error); }

.ninja-mini-stat .stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.ninja-device-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.ninja-device-row:last-child {
    border-bottom: none;
}

.device-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-display);
    letter-spacing: 0.5px;
}

.device-badge.online {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.device-badge.offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.ninja-alert-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.ninja-alert-row:last-child {
    border-bottom: none;
}

.alert-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.alert-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.alert-badge.major {
    background: rgba(234, 179, 8, 0.2);
    color: var(--warning);
}

.alert-badge.minor,
.alert-badge.moderate {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.alert-msg {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.ninja-more {
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.secret-link {
    display: block;
    color: var(--accent);
    word-break: break-all;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 10px;
    font-family: monospace;
    font-size: 0.85rem;
}

.secret-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
}

tr:hover {
    background: var(--bg-hover);
}

/* ========================================
   FORMS
   ======================================== */

.setting-input,
.setting-select,
.setting-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.setting-input:focus,
.setting-select:focus,
.setting-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.setting-select {
    cursor: pointer;
}

.setting-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ========================================
   BADGES & TAGS
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.badge-info {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ========================================
   MODALS
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow), var(--glow);
}

.modal-header {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 20px);
        right: -12px;
        bottom: 74px;
        height: calc(100vh - 100px);
        border-radius: var(--radius);
    }

    .auth-card {
        padding: 30px 24px;
    }

    .auth-logo h1 {
        font-size: 2.2rem;
    }
}
