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

:root {
    /* Dark Theme (Default) */
    --bg-main: #0b0e14;
    --bg-card: #151921;
    --bg-panel: #1c222d;

    --accent-primary: #ab0012;
    /* KENJAKU RED */
    --accent-secondary: #ff3b4b;
    /* Lighter red for hover/active */

    --accent-success: #00dc82;
    --accent-danger: #ff3b30;
    --accent-warning: #ffcc00;

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --border-color: #2d3748;
    --glass-bg: rgba(21, 25, 33, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --bg-panel: #eef1f6;

    --accent-primary: #ab0012;
    --accent-secondary: #d9041d;
    /* Darker red for light mode interaction? */

    /* Keep status colors consistent, maybe darken slightly for contrast */
    --accent-success: #00a862;
    --accent-danger: #d93025;
    --accent-warning: #e6b800;

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: #ffffff;

    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
}

[data-theme="bloomberg"] {
    /* Bloomberg Terminal Orange Theme */
    --bg-main: #000000;
    --bg-card: #0a0a0a;
    --bg-panel: #1a1a1a;

    --accent-primary: #ff6600;
    --accent-secondary: #ff8533;

    --accent-success: #00ff00;
    --accent-danger: #ff0000;
    --accent-warning: #ffff00;

    --text-primary: #ff8800;
    --text-secondary: #ffaa44;
    --text-muted: #996633;
    --text-inverse: #000000;

    --border-color: #333333;
    --glass-bg: rgba(10, 10, 10, 0.95);
    --glass-border: rgba(255, 102, 0, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 1rem 0;
    font-weight: 700;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* Header */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 25px;
}

.brand-logo {
    height: 40px;
    width: auto;
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}

/* Header Controls Group (Left side now) */
.header-controls-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Align left */
    justify-content: center;
    gap: 2px;
}

/* Mobile/Slide Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001; /* Above header */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-menu {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden by default */
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 1002; /* Above overlay */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}

.sidebar-menu.active {
    left: 0;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background 0.2s;
}

.sidebar-nav-item:hover {
    background: var(--bg-panel);
}

.sidebar-nav-item.logout {
    margin-top: auto;
    color: var(--accent-danger);
}

.sidebar-nav-item.logout:hover {
    background: rgba(255, 69, 58, 0.1);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Header Right Column (Controls + Clock) */
.header-right-column {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.logout-link {
    font-size: 0.8rem;
    color: var(--accent-danger);
    text-decoration: none;
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
}

.header-clock {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.display-mode-select {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.display-mode-select:hover {
    border-color: var(--accent-secondary);
}

.display-mode-select:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 2px rgba(255, 59, 75, 0.1);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 8px;
    /* Smaller toggle in header */
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

/* Layout & Containers */
.app-container {
    max-width: 1600px;
    /* Increased max width */
    margin: 0;
    /* Align to left instead of auto */
    padding: 2rem 3rem;
    /* Extra left-side priority padding */
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}

/* Embedded Command Bar in Header (Right Side) */
.command-bar-header {
    width: 350px;
}

.command-input-wrapper-header {
    background: var(--bg-main);
    /* Slightly darker than card header */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.2s;
}

.command-input-wrapper-header:focus-within {
    border-color: var(--accent-primary);
}

.cmd-prefix {
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    font-size: 1rem;
}

#cmdInput {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    width: 100%;
    padding: 0;
    text-align: left;
}

#cmdInput:focus {
    outline: none;
}

.command-input-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
}

.cmd-prefix {
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    font-size: 1.1rem;
}

#cmdInput {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    width: 100%;
    padding: 10px 0;
}

#cmdInput:focus {
    outline: none;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.3s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--accent-secondary);
}

.btn-secondary {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Utility */
.text-accent {
    color: var(--accent-primary);
}

.text-dim {
    color: var(--text-secondary);
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid {
    display: grid;
    gap: 20px;
}

/* Status Bar */
.status-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 36px;
    background: var(--accent-primary);
    /* Brand Footer */
    color: white;
    /* Always white on brand color */
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    z-index: 2000;
    user-select: none;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.footer-logo {
    height: 20px;
    width: auto;
    margin-right: 15px;
    filter: brightness(0) invert(1);
    /* Make logo white if it isn't already */
}

/* Status dots adapted for red background */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    margin-right: 10px;
    transition: background-color 0.3s;
}

.status-indicator.busy {
    background-color: #ffcc00;
    box-shadow: 0 0 5px #ffcc00;
}

.status-indicator.ready {
    background-color: #00dc82;
    box-shadow: 0 0 5px #00dc82;
}

.status-indicator.error {
    background-color: #000;
    box-shadow: 0 0 5px #000;
}

/* Black dot on red for error */

.status-text {
    margin-right: auto;
    color: rgba(255, 255, 255, 0.9);
}

.status-clock {
    font-weight: bold;
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}