/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================
   GLOBAL THEME TOKENS
   ============================================ */
:root {
    --bg0: #070a10;
    --bg1: #0b1220;
    --panel: #0f172a;
    --panel2: #111827;
    --border: rgba(255, 255, 255, .08);
    --border2: rgba(255, 255, 255, .12);
    --text: #e5e7eb;
    --muted: rgba(229, 231, 235, .65);
    --muted2: rgba(229, 231, 235, .45);
    --accent: #3b82f6;
    --accent2: #60a5fa;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --radius: 14px;

    /* Component sizes */
    --nav-height: 64px;
    --max-width: 1200px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background:
        radial-gradient(900px 500px at 50% 0%, rgba(59, 130, 246, .12), transparent 55%),
        linear-gradient(180deg, var(--bg1), var(--bg0));
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent2);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* ============================================
   TICKER (TOP BAR)
   ============================================ */
.top-ticker {
    background: #000;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 6px 0;
    text-align: center;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1001;
}

/* ============================================
   NAVBAR (GLOBAL)
   ============================================ */
.navbar {
    height: var(--nav-height);
    background: rgba(10, 15, 25, .75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 29px;
    /* Height of ticker */
    z-index: 1000;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    letter-spacing: -0.5px;
}

.nav-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 5px 10px;
    z-index: 1002;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.nav-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
    .nav-sidebar-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--bg1);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 40px;
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 1001;
        border-left: 1px solid var(--border);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-link {
        font-size: 1.2rem;
        width: 100%;
        text-align: center;
        padding: 15px 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-link:last-child {
        border-bottom: none;
    }
}

.nav-links {
    display: flex;
    gap: 28px;
}

.nav-link {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

/* ============================================
   CARDS / PANELS (GLOBAL)
   ============================================ */
.card,
.panel {
    background: linear-gradient(180deg, rgba(17, 24, 39, .75), rgba(15, 23, 42, .65));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

/* ============================================
   INPUTS & FORMS (GLOBAL)
   ============================================ */
.input,
.textarea,
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    background: rgba(15, 23, 42, .75);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    outline: none;
}

.input:focus,
.textarea:focus,
input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .25);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   BUTTONS (GLOBAL)
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent2);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, .05);
}

.btn:disabled,
.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.text-muted {
    color: var(--muted);
}

.text-muted2 {
    color: var(--muted2);
}

/* ============================================
   CHAT PAGE SPECIFIC
   ============================================ */
.chat-page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 10px;
    /* Reduced padding for more screen real estate */
    height: calc(100vh - var(--nav-height));
    /* Full height minus nav */
}

/* Compact Header */
.chat-page-header {
    text-align: center;
    margin-bottom: 10px;
    /* Reduced margin */
    display: none;
    /* Hide on mobile/app mode for more space, or keep small */
}

@media (min-width: 768px) {
    .chat-page-header {
        display: block;
        margin-bottom: 20px;
    }

    .chat-page-wrapper {
        padding: 20px;
    }
}

.chat-container {
    width: 100%;
    max-width: 1200px;
    /* Increased from 900px */
    background: linear-gradient(180deg, rgba(17, 24, 39, .85), rgba(15, 23, 42, .75));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    flex: 1;
    /* Take remaining height */
    overflow: hidden;
    /* Contain inner scroll */
}

/* Mobile specific overrides */
@media (max-width: 768px) {
    .chat-page-wrapper {
        padding: 0;
        /* Full width/height on mobile */
        height: calc(100dvh - var(--nav-height));
    }

    .chat-container {
        border-radius: 0;
        /* Square edges on mobile */
        border: none;
        border-top: 1px solid var(--border);
        height: 100%;
    }

    .message {
        max-width: 90%;
    }

    .toolkit-grid {
        grid-template-columns: 1fr;
    }
}

/* Toggle Switch CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--accent);
}

input:checked+.slider:before {
    -webkit-transform: translateX(16px);
    -ms-transform: translateX(16px);
    transform: translateX(16px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.friendly-label {
    margin-left: 10px;
    font-size: 0.9rem;
    color: var(--muted);
    vertical-align: middle;
}