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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 80px); /* Account for footer height */
}

/* Chat Panel */
.chat-panel {
    width: 40%;
    display: flex;
    flex-direction: column;
    background-color: #1a1a1a;
    border-right: 1px solid #333;
}

.chat-header {
    padding: 20px;
    background-color: #222;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message.user .message-content {
    background-color: #2a4a8a;
    align-self: flex-end;
    border-radius: 18px 18px 4px 18px;
}

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

.message.system .message-content {
    background-color: #1a3a5a;
    border-radius: 12px;
    border: 1px solid #2a4a7a;
}

.message-content {
    padding: 12px 16px;
    max-width: 85%;
    word-wrap: break-word;
}

.message-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

.message-content pre {
    background-color: #0a0a0a;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin-top: 10px;
}

.chat-input {
    padding: 20px;
    background-color: #222;
    border-top: 1px solid #333;
}

#prompt-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#prompt-input {
    width: 100%;
    padding: 12px;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    resize: vertical;
}

#prompt-input:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Viewer Panel */
.viewer-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0f0f0f;
}

.viewer-header {
    padding: 20px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-controls {
    display: flex;
    gap: 10px;
}

.viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#viewer-canvas {
    width: 100%;
    height: 100%;
    display: none;
}

.viewer-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.viewer-placeholder p {
    margin: 10px 0;
}

.viewer-placeholder .hint {
    font-size: 0.9rem;
    color: #555;
}

.viewer-info {
    padding: 10px 20px;
    background-color: #1a1a1a;
    border-top: 1px solid #333;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #4a9eff;
    color: white;
}

.btn-primary:hover {
    background-color: #3a8eef;
}

.btn-primary:disabled {
    background-color: #334455;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #333;
    color: #e0e0e0;
}

.btn-secondary:hover {
    background-color: #444;
}

.btn-secondary:disabled {
    background-color: #222;
    color: #666;
    cursor: not-allowed;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-message {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.loading-log {
    text-align: left;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85rem;
    color: #888;
    margin-top: 20px;
}

.loading-log:empty {
    display: none;
}

.loading-log div {
    margin: 2px 0;
}

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

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

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

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

/* Authentication Styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: #333;
    border-radius: 6px;
}

.user-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e0e0e0;
}

.btn-text {
    background: none;
    border: none;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-text:hover {
    color: #aaa;
}

/* Login Modal */
.login-modal-content {
    max-width: 400px;
    width: 90%;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: #fff;
    color: #333;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-google:hover {
    background-color: #f8f8f8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-google-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #fff;
    color: #333;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-google-header:hover {
    background-color: #f8f8f8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.login-note {
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    margin-top: 15px;
}

/* Disabled input styling */
input:disabled, textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error notification */
.error-notification {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal-content {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    z-index: 1001;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #e0e0e0;
}

.modal-body {
    padding: 30px;
}

.modal-body p {
    margin: 0 0 20px 0;
    color: #e0e0e0;
    line-height: 1.5;
}

/* Footer */
.footer {
    background: #1a1a1a;
    border-top: 1px solid #333;
    padding: 20px 0;
    text-align: center;
    flex-shrink: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer p {
    margin: 0;
    color: #888;
    font-size: 0.9rem;
}

.footer a {
    color: #4a9eff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #66b3ff;
    text-decoration: underline;
}

/* Generation Options */
.generation-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 15px;
}

.privacy-toggle {
    display: flex;
    gap: 20px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #ccc;
    user-select: none;
}

.toggle-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #555;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.toggle-label input[type="radio"]:checked + .radio-custom {
    border-color: #4a9eff;
    background-color: #4a9eff;
}

.toggle-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
}

.toggle-label:hover .radio-custom {
    border-color: #4a9eff;
}

.toggle-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label.disabled .radio-custom {
    border-color: #333;
}

.toggle-label.pro-required {
    position: relative;
}

.toggle-label.pro-required::after {
    content: 'Upgrade to Pro';
    position: absolute;
    bottom: -25px;
    left: 0;
    font-size: 0.75rem;
    color: #4a9eff;
    white-space: nowrap;
}

/* Pro Options */
.pro-options {
    margin-top: 15px;
    padding: 15px;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
}

.option-group {
    margin-bottom: 15px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #e0e0e0;
}

.option-group select {
    width: 100%;
    padding: 8px 12px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.option-group select:focus {
    outline: none;
    border-color: #4a9eff;
}

.option-group select option.pro-option {
    background-color: #2a2a2a;
    color: #4a9eff;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #666;
    border-radius: 3px;
    position: relative;
    background-color: #2a2a2a;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: #4a9eff;
    border-color: #4a9eff;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.checkbox-label:hover .checkbox-custom {
    border-color: #4a9eff;
}

.checkbox-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pro-option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .generation-options {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .privacy-toggle {
        justify-content: center;
    }
    
    .pro-options {
        margin-top: 10px;
    }
}