/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* App Container */
#app {
    min-height: 100vh;
    max-width: 100%;
}

/* Views */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: block;
}

/* Chat Interface */
.chat-header {
    text-align: center;
    padding: 40px 20px 20px;
    color: white;
}

.chat-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.chat-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.chat-examples {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px 20px;
    margin: 0 20px 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-examples p {
    color: white;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.example-chips {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.example-chip {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 15px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.example-chip:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.chat-input-form {
    padding: 20px;
    margin-top: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, #667eea);
}

.input-container {
    display: flex;
    gap: 10px;
    background: white;
    border-radius: 25px;
    padding: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.input-container input {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px 20px;
    border-radius: 25px;
    font-size: 1rem;
    background: transparent;
}

.input-container button {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 140px;
}

.input-container button:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.input-container button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Project View */
.project-view {
    background: white;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #e9ecef;
}

.header h2 {
    color: #333;
    font-size: 1.3rem;
}

.preview-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.preview-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.project-content {
    padding: 25px 20px;
}

.agent-message {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    border-left: 5px solid #667eea;
    font-size: 1.1rem;
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* File List */
.file-list h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4rem;
    font-weight: 600;
}

.files-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.file-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.file-item.loading {
    opacity: 0.7;
    animation: pulse 1.5s infinite;
}

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

.file-icon {
    font-size: 1.8rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.file-size {
    font-size: 0.9rem;
    color: #666;
}

.file-status {
    color: #28a745;
    font-weight: 600;
    font-size: 0.9rem;
}

.completion-message {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-radius: 15px;
    border: 2px solid #28a745;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.15);
}

.completion-message p {
    font-size: 1.3rem;
    font-weight: 600;
    color: #155724;
    margin-bottom: 20px;
}

.preview-btn-large {
    background: #667eea;
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.preview-btn-large:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Preview Modal */
.preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.preview-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.preview-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.preview-content {
    padding: 30px;
}

.preview-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn, .edit-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 160px;
}

.download-btn {
    background: #28a745;
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.edit-btn {
    background: #ffc107;
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.edit-btn:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-header h1 {
        font-size: 1.6rem;
    }
    
    .chat-header p {
        font-size: 1rem;
    }
    
    .input-container {
        flex-direction: column;
        gap: 0;
        border-radius: 20px;
    }
    
    .input-container input {
        border-radius: 20px 20px 0 0;
        padding: 18px 20px;
    }
    
    .input-container button {
        border-radius: 0 0 20px 20px;
        padding: 18px;
    }
    
    .header h2 {
        font-size: 1.1rem;
    }
    
    .preview-modal {
        margin: 10px;
        border-radius: 15px;
    }
    
    .preview-content {
        padding: 20px;
    }
    
    .preview-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .download-btn, .edit-btn {
        width: 100%;
        max-width: 250px;
    }
    
    .agent-message {
        font-size: 1rem;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 30px 15px 15px;
    }
    
    .chat-examples {
        margin: 0 15px 25px;
        padding: 20px 15px;
    }
    
    .project-content {
        padding: 20px 15px;
    }
    
    .file-item {
        padding: 15px;
    }
    
    .completion-message {
        padding: 20px;
        margin-top: 30px;
    }
    
    .completion-message p {
        font-size: 1.1rem;
    }
    
    .preview-btn-large {
        padding: 15px 25px;
        font-size: 1.1rem;
    }
}

/* Previous CSS same rahega, bas yeh add karo */

.api-key-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin: 0 20px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.api-key-section input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-bottom: 10px;
    font-size: 1rem;
}

.api-key-section input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.api-key-section button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
}

.api-key-section button:hover {
    background: rgba(255, 255, 255, 0.3);
}