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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Controls section */
.controls {
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 70px;
    transition: all 0.2s ease;
}

input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* SVG Preview area */
.svg-preview-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #f9f9f9;
}

.svg-preview {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1/1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.grid-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, #e0e0e0 1px, transparent 1px),
        linear-gradient(to bottom, #e0e0e0 1px, transparent 1px);
    background-size: calc(100% / var(--grid-count)) calc(100% / var(--grid-count));
    pointer-events: none;
}

.svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Editor section */
.svg-editor {
    flex: 0 0 30%;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

textarea {
    width: 100%;
    height: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    background-color: white;
    transition: all 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* Utility elements */
.coordinates-display {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    font-family: monospace;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.error-message {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background-color: rgba(255, 235, 235, 0.9);
    color: #d32f2f;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #ffcdd2;
    max-width: 80%;
    display: none;
}

.size-info {
    position: absolute;
    bottom: 15px;
    right: 15px;
    font-size: 13px;
    color: #666;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
}

/* Right controls */
.right-controls {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* Buttons */
.theme-toggle, .download-btn {
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.theme-toggle {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    color: #333;
}

.theme-toggle:hover {
    background-color: #e0e0e0;
}

.download-btn {
    background-color: #4CAF50;
    color: white;
    border: 1px solid #45a049;
}

.download-btn:hover {
    background-color: #45a049;
}

/* Dialog styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.download-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 1001;
    width: 90%;
    max-width: 400px;
    display: none;
}

.download-dialog h3 {
    margin-bottom: 15px;
    color: #333;
}

.download-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.download-options button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 120px;
}

.copy-btn {
    background-color: #2196F3;
    color: white;
}

.copy-btn:hover {
    background-color: #0b7dda;
}

.download-svg-btn {
    background-color: #4CAF50;
    color: white;
}

.download-svg-btn:hover {
    background-color: #45a049;
}

.close-dialog {
    background-color: #f44336;
    color: white;
}

.close-dialog:hover {
    background-color: #d32f2f;
}
