/* CCAI — Core Styles (Coach Chris Brand Theme) */

:root {
    --black: #000000;
    --lime: #CDFF96;
    --violet: #BA9AFD;
    --light-blue: #87C0FF;
    --white: #FFFFFF;
    --near-black: #1A1A1A;
    --dark-gray: #2A2A2A;
    --mid-gray: #3A3A3A;
    --text-gray: #999999;
    --border-gray: #333333;

    --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--white);
    background: var(--black);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout — fixed header/footer, scrollable middle */
body {
    display: flex;
    flex-direction: column;
}

/* --- Top Bar --- */
#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--near-black);
    border-bottom: 1px solid var(--border-gray);
    flex-shrink: 0;
    z-index: 100;
}

#app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--lime);
    letter-spacing: 0.5px;
}

/* --- Icon Buttons --- */
.icon-btn {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.icon-btn:hover {
    background: var(--mid-gray);
}

.icon-btn:active {
    background: var(--dark-gray);
}

/* --- Sidebar --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--near-black);
    border-right: 1px solid var(--border-gray);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

#sidebar.visible {
    transform: translateX(0);
}

#sidebar.hidden {
    transform: translateX(-100%);
}

#sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-gray);
}

#sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
}

#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 2px;
}

.conversation-item:hover {
    background: var(--dark-gray);
}

.conversation-item.active {
    background: var(--mid-gray);
}

.conversation-item .conv-title {
    font-size: 14px;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conversation-item .conv-delete {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.conversation-item:hover .conv-delete {
    opacity: 1;
}

.conversation-item .conv-delete:hover {
    color: #ff6b6b;
}

/* --- Main Chat Area --- */
#chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- Input Bar --- */
#input-bar {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--near-black);
    border-top: 1px solid var(--border-gray);
    flex-shrink: 0;
}

#input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 768px;
    margin: 0 auto;
}

#message-input {
    flex: 1;
    background: var(--dark-gray);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font);
    font-size: 16px;
    padding: 10px 14px;
    resize: none;
    max-height: 150px;
    line-height: 1.4;
    outline: none;
    transition: border-color var(--transition);
}

#message-input::placeholder {
    color: var(--text-gray);
}

#message-input:focus {
    border-color: var(--lime);
}

.send-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--mid-gray);
    transition: background var(--transition), color var(--transition);
}

.send-btn:not(:disabled) {
    background: var(--lime);
    color: var(--black);
}

.send-btn:not(:disabled):hover {
    background: #d8ff9f;
}

.send-btn:disabled {
    cursor: default;
    opacity: 0.5;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--mid-gray);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-gray);
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

/* --- Mobile adjustments --- */
@media (max-width: 480px) {
    #top-bar {
        padding: 10px 12px;
    }

    #input-bar {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    #chat-area {
        padding: 0 12px;
    }
}
