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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #18181b;
    color: #e4e4e7;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 320px;
    background: #18181b;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #27272a;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

#sidebar h1 {
    font-size: 1.5rem;
    color: #fafafa;
}

.btn-lang {
    background: #27272a;
    color: #e4e4e7;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lang:hover {
    background: #3f3f46;
}

#saveConfig,
#loadConfig {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

#loadConfig {
    margin-bottom: 0;
}

#sidebar-footer {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: #71717a;
    text-align: center;
}

#appVersion {
    font-weight: 600;
    color: #a1a1aa;
}

.subtitle {
    font-size: 0.85rem;
    color: #71717a;
    margin-bottom: 20px;
}

.section {
    background: #1f1f23;
    border: 1px solid #27272a;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.section h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a1a1aa;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #27272a;
}

.control {
    margin-bottom: 12px;
}

.control:last-child {
    margin-bottom: 0;
}

.control label {
    display: block;
    font-size: 0.85rem;
    color: #d4d4d8;
    margin-bottom: 5px;
}

.control input[type="number"],
.control select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    background: #27272a;
    color: #fafafa;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.control input[type="number"]:focus,
.control select:focus {
    outline: none;
    border-color: #71717a;
}

.control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #fafafa;
}

.control small {
    display: block;
    font-size: 0.75rem;
    color: #71717a;
    margin-top: 3px;
}

.export .btn-primary,
.export .btn-secondary {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #fafafa;
    color: #18181b;
    font-weight: 600;
}

.btn-primary:hover {
    background: #d4d4d8;
}

.btn-secondary {
    background: #27272a;
    color: #e4e4e7;
    border: 1px solid #3f3f46;
}

.btn-secondary:hover {
    background: #3f3f46;
}

.export-options {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.export-options label {
    font-size: 0.8rem;
    color: #a1a1aa;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.export-options input[type="radio"] {
    accent-color: #fafafa;
}

#canvas-container {
    flex: 1;
    position: relative;
    background: #0a0a0a;
}

#info {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #888;
    pointer-events: none;
    z-index: 10;
}

/* Scrollbar styling */
#sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-track {
    background: #18181b;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    #app {
        flex-direction: column-reverse;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }

    #canvas-container {
        flex: none;
        height: 45vh;
        height: 45dvh;
        min-height: 260px;
        position: sticky;
        top: 0;
        z-index: 50;
        border-bottom: 1px solid #27272a;
    }

    #sidebar {
        width: 100%;
        overflow-y: visible;
        border-right: none;
        padding: 16px;
    }

    #sidebar h1 {
        font-size: 1.25rem;
    }

    /* Evita el zoom automático de iOS al enfocar inputs */
    .control input[type="number"],
    .control select {
        font-size: 16px;
        padding: 10px 12px;
    }

    .btn-lang,
    .export .btn-primary,
    .export .btn-secondary,
    #saveConfig,
    #loadConfig {
        min-height: 44px;
    }

    #info {
        font-size: 0.7rem;
        bottom: 10px;
        white-space: nowrap;
    }
}
