@font-face {
    font-family: 'Berkeley Mono';
    src: local('Berkeley Mono');
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Berkeley Mono', 'Consolas', monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    color: #e0e0e0;
    position: relative; /* For absolute positioning of sidebar */
}

.editor-container {
    flex: 1;
    padding: 1rem;
    background: #242424;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    height: calc(100vh - 40px); /* Account for collapsed sidebar height */
}

#editor {
    width: 100%;
    height: calc(100% - 50px); /* Account for toolbar */
    border: none;
    outline: none;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
    padding: 15px;
    box-sizing: border-box;
    background: transparent;
    color: #e0e0e0;
    font-family: 'Berkeley Mono', 'Consolas', monospace;
    -webkit-appearance: none;
    border-radius: 0;
}

.ai-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2a2a2a;
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.ai-sidebar-header {
    padding: 10px 15px;
    background: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.ai-sidebar-header:after {
    content: '⌄';
    font-size: 20px;
    transition: transform 0.3s ease;
}

.ai-sidebar.expanded .ai-sidebar-header:after {
    transform: rotate(180deg);
}

.ai-sidebar-content {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
}

.ai-sidebar.expanded .ai-sidebar-content {
    height: 100vh;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

.ai-reflection {
    background: #333333;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease;
}

.ai-reflection p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #a0a0a0;
}

.toolbar {
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.datetime {
    font-size: 14px;
    color: #a0a0a0;
}

button {
    background: #2d4a3e;
    color: #e0e0e0;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

button:hover {
    background: #3a5f4f;
}

button:active {
    background: #2d4a3e;
}

::placeholder {
    color: #666;
}

.api-key-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #333;
    padding: 20px;
    border-radius: 8px;
    z-index: 1000;
    width: 90%;
    max-width: 400px;
}

.api-key-modal.visible {
    display: block;
}

.api-key-modal input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    background: #444;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    font-size: 16px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 999;
}

.modal-overlay.visible {
    display: block;
}

.loading {
    display: inline-block;
    margin-left: 10px;
    animation: pulse 1.5s infinite;
}

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

/* Desktop styles */
@media (min-width: 768px) {
    body {
        flex-direction: row;
    }

    .editor-container {
        padding: 2rem;
        height: 100vh;
    }

    .ai-sidebar {
        position: static;
        width: 300px;
        box-shadow: none;
    }

    .ai-sidebar-header {
        display: none;
    }

    .ai-sidebar-content {
        height: auto;
        padding: 1.5rem;
        overflow-y: auto;
    }

}

/* --- Authentication styles --- */

.login-container {
    width: 100vw;
    margin-top: 4rem;
    text-align: center;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    color: #a0a0a0;
    font-size: 14px;
}

.logout-btn {
    background: #4a2d2d;
}

.logout-btn:hover {
    background: #5f3a3a;
}

.tagline {
    margin-bottom: 4rem;
}
