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

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Product Header */
.product-header {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.product-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.build-info {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
    margin-left: 0.5rem;
    font-family: var(--font-family-mono);
    letter-spacing: 0;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    display: inline-block;
    cursor: help;
}

.github-link {
    display: inline-flex;
    align-items: center;
    margin-left: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
    vertical-align: middle;
}

.github-link:hover {
    opacity: 1;
    transform: scale(1.1);
}

.github-link svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Theme adjustments for product header */
[data-theme="dark"] .product-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-bottom-color: var(--border-color);
}

[data-theme="gwyneth"] .product-header {
    background: linear-gradient(135deg, 
        rgba(167, 139, 250, 0.95) 0%, 
        rgba(192, 132, 252, 0.95) 100%
    );
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(167, 139, 250, 0.3);
}

/* Gwyneth theme - Sailor Mercury with sparkles only ✨🌙💙 */
[data-theme="gwyneth"] body {
    background-color: #e8e3f5;
    background-image: url('../images/Portrait.sailormercury.png');
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: 500px auto;
    background-position: 85% 10%;
}


[data-theme="gwyneth"] .app {
    background: transparent;
    padding: 8px;
    gap: 8px;
}

/* Add a semi-transparent overlay to make Mercury blend with the background */
[data-theme="gwyneth"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(147, 197, 253, 0.15) 0%,
        rgba(167, 139, 250, 0.12) 50%,
        rgba(245, 208, 254, 0.15) 100%
    );
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

[data-theme="gwyneth"] .app {
    position: relative;
    z-index: 1;
}

/* Soft blue-to-purple panels (more transparent to show stars) */
[data-theme="gwyneth"] .toolbar {
    background: linear-gradient(135deg, 
        rgba(190, 196, 217, 0.75) 0%,
        rgba(201, 198, 216, 0.75) 50%,
        rgba(213, 208, 217, 0.75) 100%
    );
    border-bottom: 1px solid rgba(140, 153, 214, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin: 4px 4px 0 4px;
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.15);
}

[data-theme="gwyneth"] .format-toolbar {
    background: linear-gradient(135deg,
        rgba(186, 199, 216, 0.7) 0%,
        rgba(198, 181, 217, 0.7) 50%,
        rgba(207, 197, 217, 0.7) 100%
    );
    border-bottom: 1px solid rgba(125, 167, 215, 0.45);
    backdrop-filter: blur(10px);
    margin: 0 4px;
}

[data-theme="gwyneth"] .status-bar {
    background: linear-gradient(135deg,
        rgba(190, 196, 217, 0.7) 0%,
        rgba(201, 198, 216, 0.7) 50%,
        rgba(213, 208, 217, 0.75) 100%
    );
    border-top: 1px solid rgba(140, 153, 214, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin: 0 4px 4px 4px;
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.15);
}

/* Clean containers - just structural */
[data-theme="gwyneth"] .editor-pane,
[data-theme="gwyneth"] .preview-pane {
    background: transparent;
}

[data-theme="gwyneth"] .pane-header {
    background: linear-gradient(135deg,
        rgba(186, 199, 216, 0.7) 0%,
        rgba(198, 181, 217, 0.7) 50%,
        rgba(207, 197, 217, 0.7) 100%
    );
    border-bottom: 1px solid rgba(140, 153, 214, 0.5);
    backdrop-filter: blur(10px);
}

/* Semi-transparent editor with rounded corners */
[data-theme="gwyneth"] #editor {
    background-color: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.15);
}

/* Semi-transparent preview with rounded corners */
[data-theme="gwyneth"] .preview-content {
    background-color: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.15);
}

/* Add visible margins to editor and preview panes with rounded corners */
[data-theme="gwyneth"] .editor-pane {
    margin: 4px;
    border-radius: 12px;
    overflow: hidden;
}

[data-theme="gwyneth"] .preview-pane {
    margin: 4px;
    border-radius: 12px;
    overflow: hidden;
}

/* Soft blue-purple button styling (15% darker) */
[data-theme="gwyneth"] .btn {
    background: linear-gradient(135deg,
        rgba(190, 196, 217, 0.9) 0%,
        rgba(198, 181, 217, 0.9) 50%,
        rgba(213, 208, 217, 0.9) 100%
    );
    border-color: rgba(140, 153, 214, 0.5);
    transition: all 0.2s ease;
}

[data-theme="gwyneth"] .btn:hover {
    background: linear-gradient(135deg,
        rgba(169, 179, 216, 0.95) 0%,
        rgba(188, 182, 216, 0.95) 50%,
        rgba(201, 188, 217, 0.95) 100%
    );
    border-color: rgba(110, 119, 211, 0.65);
    transform: translateY(-1px);
}

[data-theme="gwyneth"] .btn.active {
    background: linear-gradient(135deg,
        rgba(140, 153, 214, 0.95) 0%,
        rgba(167, 154, 215, 0.95) 50%,
        rgba(188, 182, 216, 0.95) 100%
    );
    border-color: rgba(84, 87, 205, 0.75);
}

/* Blue-purple divider (15% darker) */
[data-theme="gwyneth"] .pane-divider {
    background: linear-gradient(180deg,
        rgba(140, 153, 214, 0.4) 0%,
        rgba(142, 118, 213, 0.45) 50%,
        rgba(140, 153, 214, 0.4) 100%
    );
}

/* App layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Animation for theme transitions */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Focus styles for accessibility */
button:focus,
textarea:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/error states */
.success {
    color: var(--success-color);
}

.error {
    color: var(--danger-color);
}

/* Utility classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fullscreen mode styles */
.app.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
}

.fullscreen-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    transform: translateY(-10px);
    animation: slideInFromTop 0.3s ease forwards;
}

@keyframes slideInFromTop {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth exit animation for fullscreen toggle */
.fullscreen-mode-toggle.exiting {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.fullscreen-mode-toggle .mode-btn {
    padding: 8px;
    border: 1px solid transparent;
    background-color: transparent;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.fullscreen-mode-toggle .mode-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.fullscreen-mode-toggle .mode-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.fullscreen-mode-toggle .mode-btn.active:hover {
    background-color: var(--accent-color);
    opacity: 0.9;
}

/* Fullscreen mode main content adjustments */
.app.fullscreen-mode .main-content {
    flex: 1;
    height: 100vh;
    transition: all 0.3s ease;
}

.app.fullscreen-mode .editor-container {
    height: 100vh;
    transition: all 0.3s ease;
}

.app.fullscreen-mode .editor-pane,
.app.fullscreen-mode .preview-pane {
    height: 100vh;
    transition: all 0.3s ease;
}

/* Ensure editor and preview take full height in fullscreen */
.app.fullscreen-mode #editor {
    height: 100vh;
    transition: all 0.3s ease;
}

.app.fullscreen-mode .preview-content {
    height: 100vh;
    transition: all 0.3s ease;
}

/* Keyboard shortcut for exiting fullscreen */
@media (max-width: 768px) {
    .fullscreen-mode-toggle {
        top: 10px;
        right: 10px;
        padding: 6px;
        gap: 6px;
    }
    
    .fullscreen-mode-toggle .mode-btn {
        padding: 6px;
    }
}
