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

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f1115;
    color: #f1f5f9;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: #1a1d24;
    border-right: 1px solid #2d313a;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.logo h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #e2e8f0;
}

.logo span {
    color: #3b82f6;
}

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

.section-header h3, .prompt-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: #f1f5f9;
}

#page-list {
    list-style: none;
    margin-bottom: 30px;
}

.page-item {
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
}

.page-item:hover, .page-item.active {
    background-color: #2d313a;
}

.prompt-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.prompt-section textarea {
    flex: 1;
    background-color: #0f1115;
    border: 1px solid #2d313a;
    border-radius: 6px;
    padding: 15px;
    color: #f1f5f9;
    resize: none;
    margin-top: 10px;
    margin-bottom: 15px;
    font-family: inherit;
    font-size: 14px;
}

.prompt-section textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.primary-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    width: 100%;
}

.primary-btn:hover:not(:disabled) {
    background-color: #2563eb;
}

.primary-btn:disabled {
    background-color: #475569;
    cursor: not-allowed;
    opacity: 0.7;
}

.primary-btn.outline {
    background-color: transparent;
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

.primary-btn.outline:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.export-section {
    margin-top: 20px;
}

/* Main Area */
.work-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.topbar {
    height: 60px;
    border-bottom: 1px solid #2d313a;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background-color: #1a1d24;
}

.view-toggles {
    display: flex;
    gap: 10px;
    background-color: #0f1115;
    padding: 4px;
    border-radius: 8px;
}

.toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.toggle-btn.active {
    background-color: #2d313a;
    color: #f1f5f9;
}

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

.view {
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* Upload View */
#view-upload {
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-container {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.upload-box {
    border: 2px dashed #3b82f6;
    border-radius: 12px;
    padding: 40px;
    background-color: rgba(59, 130, 246, 0.05);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-box:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.image-preview-container {
    position: relative;
    margin-bottom: 20px;
}

#image-preview {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Preview View */
#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background-color: white; 
}

/* Code View */
#view-code {
    background-color: #1d1f21;
    padding: 20px;
}

#view-code pre {
    margin: 0;
}

/* Loading Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 21, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 100;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.shiny {
    position: relative;
    overflow: hidden;
}

.shiny::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}
