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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

/* Project List Page */
.project-list-page {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.project-list-page h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.project-list-page .subtitle {
    color: #666;
    margin-bottom: 30px;
}

.new-project-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.new-project-form input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.new-project-form input:focus {
    outline: none;
    border-color: #6965db;
}

.new-project-form button {
    padding: 12px 24px;
    background: #6965db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.new-project-form button:hover {
    background: #5a56c7;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.project-card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.project-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.project-card .date {
    margin-top: 12px;
    font-size: 12px;
    color: #999;
}

/* Editor Page */
.editor-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.editor-header {
    background: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
}

.editor-header h2 {
    font-size: 1.25rem;
    color: #1a1a1a;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions button {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.header-actions button:hover {
    background: #f5f5f5;
}

.header-actions button.primary {
    background: #6965db;
    color: white;
    border-color: #6965db;
}

.header-actions button.primary:hover {
    background: #5a56c7;
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: calc(100vh - 60px);
}

/* Drawing Board */
.drawing-board {
    flex: 3;
    position: relative;
    background: #fff;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
}

.excalidraw-wrapper {
    height: 100%;
    width: 100%;
    position: relative;
    min-width: 400px;
    min-height: 400px;
}

.excalidraw-wrapper > div {
    height: 100% !important;
    width: 100% !important;
}

/* Ensure Excalidraw fills container */
.excalidraw-wrapper [data-testid="excalidraw"] {
    width: 100% !important;
    height: 100% !important;
}

/* Resizer */
.resizer {
    width: 6px;
    background: #e0e0e0;
    cursor: col-resize;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resizer:hover {
    background: #6965db;
}

.resizer::after {
    content: '';
    width: 2px;
    height: 40px;
    background: #999;
    border-radius: 1px;
}

/* Chat Panel */
.chat-panel {
    flex: 1;
    min-width: 300px;
    background: white;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.chat-header h3 {
    font-size: 16px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header .ai-badge {
    background: #6965db;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    scroll-behavior: smooth;
}

.message {
    max-width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: #6965db;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message .timestamp {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

/* Thinking/Typing Indicator */
.message.thinking {
    background: #f0f0f0;
    color: #666;
    font-style: italic;
    opacity: 0.8;
}

.thinking-dots {
    animation: pulse 1.4s infinite;
    letter-spacing: 2px;
}

@keyframes pulse {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.chat-input-container {
    padding: 12px 20px 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
    flex-shrink: 0;
    position: relative;
    min-height: 80px;
    max-height: 400px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Resizer handle above input */
.chat-input-resizer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: #e8e8e8;
    cursor: row-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-top: 1px solid #ddd;
    user-select: none;
    -webkit-user-select: none;
}

.chat-input-resizer:hover {
    background: #d0d0d0;
}

.chat-input-resizer::after {
    content: '';
    width: 50px;
    height: 3px;
    background: #999;
    border-radius: 2px;
}

.chat-input {
    display: flex;
    gap: 10px;
    align-items: stretch;
    height: calc(100% - 8px);
    margin-top: 8px;
}

.chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    min-height: 44px;
    height: 100%;
    max-height: none;
    overflow-y: auto;
    line-height: 1.4;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #6965db;
}

.chat-input button {
    padding: 12px 20px;
    background: #6965db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.chat-input button:hover {
    background: #5a56c7;
}

.chat-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-size: 18px;
    color: #666;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #666;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}
