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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a1a, #1a1a2e, #16213e);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.title-section {
    text-align: left;
}

.title {
    font-size: 2rem;
    font-weight: 300;
    background: linear-gradient(45deg, #00d4ff, #ff00ff, #ffff00);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    color: #cccccc;
    opacity: 0.8;
    font-style: italic;
}

.fractal-selector {
    display: flex;
    gap: 0.5rem;
}

.fractal-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.fractal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.fractal-btn.active {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.zoom-display {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Main Area - Dual Panel Layout */
.main-area {
    display: flex;
    flex: 1;
    position: relative;
    gap: 1rem;
    padding: 1rem;
}

.dual-panel-container {
    display: flex;
    flex: 1;
    gap: 1rem;
    min-height: 600px;
}

/* Fractal Panel (Left) */
.fractal-panel {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#fractal-canvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}

.crosshair {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #00ff88;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0.7;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* AI Trigger Section */
.ai-trigger-section {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.generate-ai-btn {
    background: linear-gradient(45deg, #ff00ff, #ff6600);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.3);
    width: 100%;
    max-width: 300px;
}

.generate-ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 0, 255, 0.5);
}

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

.ai-status {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #cccccc;
    font-style: italic;
}

/* AI Panel (Right) */
.ai-panel {
    width: 400px;
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 0, 255, 0.2);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
}

.ai-panel.collapsed {
    width: 60px;
}

.ai-panel.collapsed .ai-content {
    display: none;
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 0, 255, 0.2);
    background: rgba(255, 0, 255, 0.1);
}

.ai-panel-header h3 {
    margin: 0;
    color: #ff00ff;
    font-size: 1.1rem;
}

.toggle-ai-btn {
    background: none;
    border: none;
    color: #ff00ff;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.toggle-ai-btn:hover {
    background: rgba(255, 0, 255, 0.2);
}

.ai-content {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

/* AI Image Display */
.ai-image-display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 0, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.ai-generated-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.3);
}

.ai-placeholder {
    text-align: center;
    color: #cccccc;
    padding: 2rem;
}

.ai-placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.ai-placeholder p {
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.8;
}

/* AI Loading */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: rgba(255, 0, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 0, 255, 0.3);
}

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 0, 255, 0.3);
    border-top: 3px solid #ff00ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced AI Prompt Display */
.ai-prompt-display {
    background: rgba(255, 255, 0, 0.1);
    border: 1px solid rgba(255, 255, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
}

.ai-prompt-display h4 {
    color: #ffff00;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.ai-prompt-display p {
    font-size: 0.85rem;
    color: #cccccc;
    line-height: 1.4;
    font-style: italic;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 4px;
}

/* AI History */
.ai-history h4 {
    color: #00ff88;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.ai-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
}

.ai-thumbnail {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-thumbnail:hover {
    transform: scale(1.05);
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.ai-thumbnail img {
    width: 100%;
    height: 60px;
    object-fit: cover;
}

.thumbnail-info {
    padding: 0.25rem;
    text-align: center;
}

.thumbnail-info small {
    font-size: 0.7rem;
    color: #999;
    display: block;
    line-height: 1.2;
}

/* Enhanced AI Controls */
.ai-settings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ai-settings label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #cccccc;
}

.ai-settings input[type="checkbox"] {
    accent-color: #ff00ff;
}

.ai-settings select {
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.85rem;
}

.ai-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.ai-action-btn {
    padding: 0.5rem;
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.ai-action-btn:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.ai-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Enhanced Control Panel */
.control-panel {
    width: 300px;
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: fit-content;
    max-height: 80vh;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    margin: 0;
    color: #00d4ff;
}

.toggle-btn {
    background: none;
    border: none;
    color: #00d4ff;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.panel-content {
    padding: 1rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #cccccc;
    font-size: 0.9rem;
}

/* Enhanced iteration control hint */
.control-hint {
    display: block;
    font-size: 0.8rem;
    color: #00ff88;
    margin-top: 0.25rem;
    font-style: italic;
}

.control-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
    accent-color: #00d4ff;
}

.control-group select {
    width: 100%;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
}

.control-group select option {
    background: #1a1a2e;
    color: white;
}

.control-group input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #00d4ff;
}

.julia-controls h4 {
    color: #ff00ff;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.julia-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.preset-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 0, 255, 0.2);
    border: 1px solid rgba(255, 0, 255, 0.4);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: rgba(255, 0, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.navigation-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.nav-btn {
    padding: 0.75rem;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.info-panel h4 {
    color: #00ff88;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.coordinates, .performance {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #cccccc;
    margin-bottom: 0.5rem;
}

.coordinates span, .performance span {
    display: block;
    margin-bottom: 0.25rem;
}

.famous-locations {
    margin-top: 1.5rem;
}

.famous-locations h4 {
    color: #ffff00;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.location-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 0, 0.1);
    border: 1px solid rgba(255, 255, 0, 0.3);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-align: left;
}

.location-btn:hover {
    background: rgba(255, 255, 0, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.3);
}

/* Enhanced Simplified Info Section */
.simplified-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.simplified-info h4 {
    color: #ff00ff;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.process-info p {
    font-size: 0.85rem;
    color: #cccccc;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.process-info strong {
    color: #00ff88;
}

/* Footer */
.footer {
    padding: 1rem 2rem;
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.9rem;
    color: #cccccc;
}

.footer a {
    color: #00d4ff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #ffffff;
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
}

.math-info {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dual-panel-container {
        flex-direction: column;
    }
    
    .ai-panel {
        width: 100%;
        height: 400px;
    }
    
    .ai-panel.collapsed {
        height: 60px;
        width: 100%;
    }
    
    .main-area {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }

    .main-area {
        padding: 0.5rem;
    }

    .fractal-panel {
        min-width: auto;
    }

    .navigation-controls {
        grid-template-columns: 1fr;
    }

    .julia-presets {
        justify-content: center;
    }
    
    .ai-thumbnails {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }

    .fractal-selector {
        flex-direction: column;
        width: 100%;
    }

    .fractal-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .panel-content {
        padding: 0.75rem;
    }

    .footer {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .generate-ai-btn {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
}

/* Custom scrollbar */
.control-panel::-webkit-scrollbar,
.ai-content::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track,
.ai-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.5);
    border-radius: 3px;
}

.ai-content::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 255, 0.5);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover,
.ai-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.7);
}