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

:root {
    --primary-dark: #0a0a0a;
    --secondary-dark: #1a1a1a;
    --accent-red: #ff0040;
    --accent-orange: #ff6b00;
    --accent-cyan: #00d4ff;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    --border-color: #333333;
    --success-color: #00ff88;
    --warning-color: #ffaa00;
    --error-color: #ff4444;
    --shadow-intense: 0 0 30px rgba(255, 0, 64, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.2);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1a0a0a 50%, var(--secondary-dark) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 0, 64, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 107, 0, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundPulse 8s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.7; }
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Header Styles */
.header {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 
        var(--shadow-intense),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-red), var(--accent-cyan), transparent);
    animation: headerGlow 3s linear infinite;
}

@keyframes headerGlow {
    0% { left: -100%; }
    100% { left: 100%; }
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.8em;
    font-weight: 900;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.logo i {
    margin-right: 12px;
    font-size: 1.3em;
    background: linear-gradient(45deg, var(--accent-red), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    0% { filter: drop-shadow(0 0 5px rgba(255, 0, 64, 0.5)); }
    100% { filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.5)); }
}

.nav {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.nav-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 64, 0.2);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    color: white;
    box-shadow: var(--shadow-intense);
    transform: translateY(-1px);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-red));
    animation: activeGlow 2s ease-in-out infinite alternate;
}

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

.actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    color: white;
    box-shadow: var(--shadow-intense);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 
        var(--shadow-intense),
        0 10px 25px rgba(255, 0, 64, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Main Content */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Editor Section */
.editor-section, .preview-section {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 
        var(--shadow-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.editor-section::before, .preview-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-red), transparent);
    opacity: 0.6;
}

.editor-header, .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.editor-header h2, .preview-header h2 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-header h2 i, .preview-header h2 i {
    background: linear-gradient(45deg, var(--accent-red), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.editor-controls, .preview-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    border: 1px solid transparent;
}

.control-btn:hover {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    color: white;
    transform: translateY(-2px);
    border-color: var(--accent-red);
    box-shadow: 0 5px 15px rgba(255, 0, 64, 0.3);
}

.editor-container {
    display: none;
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.editor-container.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

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

.code-editor {
    width: 100%;
    height: 100%;
    border: none;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #0d1117;
    color: #f0f6fc;
    resize: none;
    outline: none;
    tab-size: 2;
    -moz-tab-size: 2;
}

.code-editor:focus {
    box-shadow: inset 0 0 0 2px var(--accent-cyan);
}

/* Preview Section */
.preview-container {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #ffffff;
    position: relative;
}

.preview-container::before {
    content: 'LIVE PREVIEW';
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-red);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    z-index: 10;
    animation: pulse 2s infinite;
}

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

#preview {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    /* Removed all filters and transitions for accurate color display */
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 500;
}

/* Loading States */
.loading {
    animation: spin 1s linear infinite;
}

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

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    z-index: 10000;
    max-width: 350px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    animation: notificationSlide 0.3s ease-out;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 12px;
    }
    
    .main {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .editor-container,
    .preview-container {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 8px;
        gap: 8px;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .logo {
        font-size: 1.4em;
        order: 1;
    }
    
    .nav {
        order: 2;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        padding: 6px;
    }
    
    .actions {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-btn {
        padding: 8px 14px;
        font-size: 11px;
        flex: 1;
        min-width: 70px;
        justify-content: center;
    }
    
    .btn {
        padding: 8px 18px;
        font-size: 11px;
        flex: 1;
        justify-content: center;
    }
    
    .editor-section,
    .preview-section {
        padding: 12px;
        margin: 0;
        border-radius: 8px;
    }
    
    .editor-container,
    .preview-container {
        height: 400px;
    }
    
    .code-editor {
        padding: 12px;
        font-size: 12px;
    }
    
    .editor-header,
    .preview-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .editor-controls,
    .preview-controls {
        justify-content: center;
        width: 100%;
    }
    
    .control-btn {
        flex: 1;
        max-width: 70px;
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Mobile-specific full-width adjustments */
    .main {
        display: block;
    }
    
    .editor-section {
        margin-bottom: 8px;
    }
    
    .preview-section {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 6px;
        gap: 6px;
    }
    
    .header {
        padding: 10px;
        gap: 10px;
    }
    
    .logo {
        font-size: 1.2em;
        letter-spacing: 1px;
    }
    
    .nav {
        padding: 4px;
        gap: 4px;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 10px;
        letter-spacing: 0.5px;
        min-width: 60px;
    }
    
    .btn {
        padding: 6px 14px;
        font-size: 10px;
    }
    
    .editor-section,
    .preview-section {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .editor-container,
    .preview-container {
        height: 350px;
        width: 100%;
    }
    
    .code-editor {
        padding: 10px;
        font-size: 11px;
    }
    
    .editor-header h2,
    .preview-header h2 {
        font-size: 0.9em;
    }
    
    .control-btn {
        padding: 6px 8px;
        font-size: 11px;
        max-width: 60px;
    }
    
    .notification {
        top: 10px;
        right: 6px;
        left: 6px;
        max-width: none;
        font-size: 12px;
        padding: 12px 16px;
    }
    
    /* Ensure full-width on very small screens */
    .main {
        display: block;
        width: 100%;
    }
    
    .preview-section {
        width: 100% !important;
        margin: 0 !important;
    }
    
    .preview-container {
        width: 100% !important;
        margin: 0 !important;
    }
    
    #preview {
        width: 100% !important;
        height: 100% !important;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 4px;
        gap: 4px;
    }
    
    .nav {
        flex-direction: column;
        gap: 4px;
        padding: 4px;
    }
    
    .nav-btn {
        width: 100%;
        padding: 8px;
        font-size: 10px;
    }
    
    .actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn {
        width: 100%;
        padding: 8px;
        font-size: 10px;
    }
    
    .editor-container,
    .preview-container {
        height: 300px;
        width: 100%;
    }
    
    .editor-section,
    .preview-section {
        padding: 8px;
        width: 100%;
        margin: 0;
    }
    
    /* Ultra-small screen optimizations */
    .main {
        display: block !important;
        width: 100% !important;
        gap: 4px;
    }
    
    .preview-section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 8px !important;
    }
    
    .preview-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .preview-container::before {
        font-size: 8px;
        padding: 2px 6px;
        top: 5px;
        right: 5px;
    }
}

/* Custom Scrollbar */
.code-editor::-webkit-scrollbar {
    width: 8px;
}

.code-editor::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-cyan));
    border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-red));
}

/* Focus States */
.nav-btn:focus,
.btn:focus,
.control-btn:focus {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-dark: #000000;
        --secondary-dark: #111111;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #555555;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

