/* Windows XP Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Tahoma, Arial, sans-serif;
    font-size: 11px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background: #5a9fd4; /* XP Desktop Blue */
}

/* Lava Background Iframe Container */
.lava-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.lava-background iframe {
    width: 100vw;
    height: 100vh;
    border: none;
    pointer-events: none;
    transform: scale(1.02);
    transform-origin: center center;
}

/* Main Container */
.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Windows XP Window */
.xp-window {
    width: 480px;
    background: #ece9d8;
    border: 1px solid #0054e3;
    box-shadow: 
        0 0 0 1px #316ac5,
        0 8px 16px rgba(0, 0, 0, 0.3);
    animation: xpWindowOpen 0.3s ease-out;
    position: absolute;
    top: 20px;
    right: 20px;
    user-select: none;
    z-index: 10;
}

/* Mobile positioning */
@media (max-width: 768px) {
    .xp-window {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }
}

@keyframes xpWindowOpen {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* XP Title Bar */
.xp-titlebar {
    background: linear-gradient(to bottom, #0054e3 0%, #0054e3 3%, #4e8dd9 8%, #316ac5 93%, #0054e3 97%, #0054e3 100%);
    padding: 3px 6px 3px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #0054e3;
    color: white;
    font-weight: bold;
    font-size: 11px;
    cursor: move;
    user-select: none;
    touch-action: none; /* Prevent scrolling on mobile when dragging */
}

@media (max-width: 768px) {
    .xp-titlebar {
        padding: 8px 10px;
        font-size: 12px;
        min-height: 40px; /* Larger touch target */
    }
}

.xp-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.xp-controls {
    display: flex;
    gap: 2px;
}

.xp-btn {
    width: 16px;
    height: 14px;
    background: linear-gradient(to bottom, #ddd 0%, #bbb 50%, #999 100%);
    border: 1px outset #ccc;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-family: 'Marlett', sans-serif;
}

@media (max-width: 768px) {
    .xp-btn {
        width: 24px;
        height: 22px;
        font-size: 12px;
    }
}

.xp-btn:hover {
    background: linear-gradient(to bottom, #eee 0%, #ccc 50%, #aaa 100%);
}

.xp-btn:active {
    border: 1px inset #ccc;
    background: linear-gradient(to bottom, #aaa 0%, #ccc 50%, #eee 100%);
}

.xp-btn.close {
    background: linear-gradient(to bottom, #ff6b6b 0%, #ff5252 50%, #d32f2f 100%);
    color: white;
}

.xp-btn.close:hover {
    background: linear-gradient(to bottom, #ff8a80 0%, #ff6b6b 50%, #ff5252 100%);
}

/* XP Content Area */
.xp-content {
    padding: 12px;
    background: #ece9d8;
    min-height: 300px;
}

@media (max-width: 768px) {
    .xp-content {
        padding: 16px;
        min-height: auto;
    }
}

.xp-header {
    margin-bottom: 16px;
    text-align: center;
}

.xp-header h2 {
    color: #000;
    font-size: 12px;
    font-weight: normal;
    margin-bottom: 8px;
}

/* XP Form Elements */
.xp-form-group {
    margin-bottom: 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .xp-form-group {
        margin-bottom: 20px;
    }
}

/* XP Preset Section */
.xp-preset-section {
    margin-bottom: 16px;
    border: 1px inset #ccc;
    background: #f5f5f5;
    padding: 8px;
}

@media (max-width: 768px) {
    .xp-preset-section {
        padding: 12px;
    }
}

.xp-preset-header {
    color: #000;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e1e1e1;
    padding: 4px 8px;
    border: 1px outset #ccc;
}

@media (max-width: 768px) {
    .xp-preset-header {
        font-size: 12px;
        padding: 8px 12px;
    }
}

.xp-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .xp-preset-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .xp-preset-grid {
        gap: 12px;
    }
}

.xp-preset-item {
    background: #fff;
    border: 2px outset #ccc;
    padding: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.1s ease;
}

@media (max-width: 768px) {
    .xp-preset-item {
        padding: 12px;
        min-height: 80px; /* Larger touch target */
    }
}

.xp-preset-item:hover:not(.disabled) {
    background: #f0f0f0;
    border: 2px outset #ddd;
}

.xp-preset-item:active:not(.disabled) {
    border: 2px inset #ccc;
    background: #e8e8e8;
}

.xp-preset-item.active {
    border: 2px inset #0054e3;
    background: #e6f3ff;
}

.xp-preset-item.disabled {
    opacity: 0.5;
    cursor: default;
    background: #f8f8f8;
}

.xp-preset-preview {
    width: 40px;
    height: 30px;
    margin: 0 auto 4px;
    border: 1px solid #999;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .xp-preset-preview {
        width: 60px;
        height: 45px;
        margin: 0 auto 8px;
    }
}

.preset-lava-orange {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #2ecc71, #27ae60, #16a085);
    animation: lavaFlow 3s ease-in-out infinite;
}

.preset-lava-blue {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1e3c72, #2a5298, #4facfe);
    animation: lavaFlow 3s ease-in-out infinite reverse;
}

.preset-coming-soon {
    width: 100%;
    height: 100%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #999;
}

@keyframes lavaFlow {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.xp-preset-label {
    font-size: 10px;
    color: #000;
    font-weight: normal;
}

@media (max-width: 768px) {
    .xp-preset-label {
        font-size: 12px;
    }
}

.xp-button {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 50%, #d8d8d8 100%);
    border: 1px outset #ccc;
    padding: 6px 16px;
    font-size: 11px;
    font-family: Tahoma, Arial, sans-serif;
    cursor: pointer;
    color: #000;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 200px;
    justify-content: center;
}

@media (max-width: 768px) {
    .xp-button {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 250px;
        min-height: 44px; /* iOS touch target recommendation */
    }
}

.xp-button:hover {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%);
}

.xp-button:active {
    border: 1px inset #ccc;
    background: linear-gradient(to bottom, #d0d0d0 0%, #e0e0e0 50%, #f0f0f0 100%);
}

/* XP Code Container */
.xp-code-container {
    display: none;
    margin-top: 16px;
    border: 1px inset #ccc;
    background: #fff;
    padding: 8px;
}

.xp-code-header {
    color: #000;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e1e1e1;
    padding: 4px 8px;
    border: 1px outset #ccc;
}

.xp-code-wrapper {
    position: relative;
    border: 1px inset #ccc;
    background: #fff;
}

.xp-code-block {
    background: #fff;
    border: none;
    color: #000;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    line-height: 1.4;
    width: 100%;
    min-height: 80px;
    resize: none;
    outline: none;
}

.xp-copy-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 50%, #d8d8d8 100%);
    border: 1px outset #ccc;
    padding: 2px 8px;
    font-size: 10px;
    font-family: Tahoma, Arial, sans-serif;
    cursor: pointer;
    color: #000;
    white-space: nowrap;
}

.xp-copy-btn:hover {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%);
}

.xp-copy-btn:active {
    border: 1px inset #ccc;
    background: linear-gradient(to bottom, #d0d0d0 0%, #e0e0e0 50%, #f0f0f0 100%);
}

.xp-copy-btn.copied {
    background: linear-gradient(to bottom, #c8e6c9 0%, #a5d6a7 50%, #81c784 100%);
    color: #2e7d32;
}

/* XP Scrollbars */
.xp-code-block::-webkit-scrollbar {
    width: 16px;
}

.xp-code-block::-webkit-scrollbar-track {
    background: #f1f1f1;
    border: 1px inset #ccc;
}

.xp-code-block::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 50%, #d8d8d8 100%);
    border: 1px outset #ccc;
}

.xp-code-block::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%);
}

.xp-code-block::-webkit-scrollbar-button {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 50%, #d8d8d8 100%);
    border: 1px outset #ccc;
    height: 16px;
}

.xp-code-block::-webkit-scrollbar-button:hover {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 50%, #e0e0e0 100%);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 12px;
    }
    
    .container {
        padding: 0;
    }
    
    .xp-header h2 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .xp-code-block {
        font-size: 11px;
        padding: 12px;
        min-height: 100px;
    }
    
    .xp-copy-btn {
        padding: 6px 12px;
        font-size: 11px;
        min-height: 32px;
    }
}