﻿/* ═══════════════════════════════════════════════════════════
   RESET & BASE STYLES
   ═══════════════════════════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    -webkit-tap-highlight-color: transparent; /* Removes blue highlight on mobile tap */
    touch-action: manipulation;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTAINER
   ═══════════════════════════════════════════════════════════ */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.app-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════
   CANVAS AREA
   ═══════════════════════════════════════════════════════════ */
.canvas-wrapper {
    width: 100%;
    background-color: #f0f0f0; 
    position: relative;
    /* Min-height ensures it doesn't collapse before canvas loads */
    min-height: 400px; 
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* ═══════════════════════════════════════════════════════════
   CONTROLS SECTION (Buttons)
   ═══════════════════════════════════════════════════════════ */
.controls-section {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap; /* Allows wrapping on very small screens */
    gap: 10px;
}

.button-group {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 12px;
    background: #f0f2f5;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   WRAP MODE BUTTONS
   ═══════════════════════════════════════════════════════════ */
.wrap-mode-section {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
}

.wrap-label {
    font-weight: 600;
    color: #444;
}

.wrap-buttons {
    display: flex;
    gap: 10px;
}

.wrap-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.wrap-btn.active {
    background: #764ba2;
    color: white;
    border-color: #764ba2;
}

/* ═══════════════════════════════════════════════════════════
   SLIDERS, INPUTS & COLORS
   ═══════════════════════════════════════════════════════════ */
.slider-section, 
.text-section, 
.color-section {
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
}

.slider-section label, 
.text-section label, 
.color-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

/* Range Slider Styling */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Text Area */
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
}

textarea:focus {
    outline: 2px solid #667eea;
    border-color: transparent;
}

/* Color Picker */
input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

/* ═══════════════════════════════════════════════════════════
   DOWNLOAD BUTTONS
   ═══════════════════════════════════════════════════════════ */
.download-section {
    padding: 20px;
    background: #f9f9f9;
}

.download-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-direction: column;
}

.download-btn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #667eea;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.download-btn:hover {
    background: #5a6fd1;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.app-footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════ */
@media screen and (min-width: 768px) {
    body { 
        padding: 30px; 
    }
    .download-buttons { 
        flex-direction: row; 
    }
    .download-btn { 
        flex: 1; 
    }
}