* {
    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;
    color: #333;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

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

.rocket {
    display: inline-block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

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

.template-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.template-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.template-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.template-info {
    padding: 15px;
}

.template-info h3 {
    margin-bottom: 8px;
    color: #374151;
}

.template-info p {
    color: #6b7280;
    font-size: 14px;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 25px;
    align-items: start;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.editor-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    gap: 20px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.project-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.project-input:focus {
    outline: none;
    border-color: #667eea;
}

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

/* File Tabs */
.file-tabs {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.tabs-container {
    display: flex;
    flex: 1;
    overflow-x: auto;
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
}

.file-tab.active {
    background: white;
    border-color: #667eea;
    border-bottom: 2px solid white;
    margin-bottom: -1px;
}

.file-tab:hover {
    background: #f3f4f6;
}

.file-tab.active:hover {
    background: white;
}

.close-tab {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    margin-left: 5px;
    border-radius: 3px;
    font-size: 14px;
}

.close-tab:hover {
    background: #ef4444;
    color: white;
}

.add-file-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #666;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-file-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Editor */
.editor-container {
    margin-bottom: 20px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 0;
}

.file-name {
    font-weight: 600;
    color: #374151;
}

.editor-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.editor-actions select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
}

.CodeMirror {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    height: 400px;
}

.CodeMirror-focused {
    border-color: #667eea;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-explorer {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.file-explorer h3 {
    color: #374151;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-item:hover {
    background: #f3f4f6;
}

.file-item.active {
    background: #667eea;
    color: white;
}

/* Preview Window */
.preview-window {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    height: 400px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Full-screen preview mode */
.preview-window.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 0;
    z-index: 1000;
    background: #1a1a1a;
}

.preview-window.fullscreen .preview-header {
    background: #2d2d2d;
    color: white;
    padding: 15px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid #444;
}

.preview-window.fullscreen .preview-header h3 {
    color: white;
}

.preview-window.fullscreen .btn-secondary {
    background: #ff4757;
    color: white;
    border: none;
}

.preview-window.fullscreen .btn-secondary:hover {
    background: #ff3838;
}

.preview-window.fullscreen #previewFrame {
    border: none;
    border-radius: 0;
    height: calc(100vh - 70px);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.preview-header h3 {
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

#previewFrame {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    width: 100%;
}

/* Status Cards */
.status-card, .links-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-header h3 {
    color: #374151;
    font-size: 1.1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.loading {
    background: #fbbf24;
}

.status-indicator.success {
    background: #10b981;
}

.status-indicator.error {
    background: #ef4444;
}

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

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 13px;
}

.status-badge {
    background: #10b981;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Links */
.links-card h3 {
    color: #374151;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-item {
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.link-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.link-title {
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}

.link-button {
    background: #667eea;
    color: white;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.2s;
}

.link-button:hover {
    background: #5a67d8;
}

.link-url {
    font-family: monospace;
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    word-break: break-all;
}

.link-description {
    font-size: 11px;
    color: #9ca3af;
}

/* Utilities */
.hidden {
    display: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .project-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .file-tabs {
        overflow-x: auto;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}
