/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* Fondo principal */
.south-park-bg {
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    min-height: 100vh;
}

.min-h-screen {
    min-height: 100vh;
}

/* Contenedor principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.title {
    font-size: 3rem;
    font-weight: bold;
    color: #EA580C;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.25rem;
    color: #1E40AF;
    font-weight: 500;
}

/* Grid principal */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 100%;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Panel del creador */
.creator-panel {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 24px;
    border: 4px solid #FB923C;
}

/* Canvas del personaje */
.character-canvas {
    background: linear-gradient(135deg, #FFE4B5 0%, #F0E68C 100%);
    border-radius: 12px;
    padding: 24px;
    border: 2px solid #FB923C;
    margin-bottom: 24px;
    min-height: 400px;
    position: relative;
}

/* Controles del personaje */
.character-controls {
    margin-top: 16px;
}

/* Tabs */
.tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

.tab-button {
    padding: 8px 12px;
    border: none;
    background: #E5E7EB;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-button:hover {
    background: #D1D5DB;
}

.tab-button.active {
    background: #3B82F6;
    color: white;
}

/* Tab panels */
.tab-content {
    position: relative;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Formularios */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-section {
    margin-bottom: 24px;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
}

.form-section h3 {
    margin-bottom: 12px;
    color: #374151;
    font-weight: 600;
}

label {
    font-weight: 500;
    margin-bottom: 4px;
    color: #374151;
}

input, select {
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Grids de colores */
.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.color-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #E5E7EB;
    cursor: pointer;
    transition: all 0.2s;
}

.color-button:hover {
    transform: scale(1.1);
}

.color-button.active {
    border-color: #1F2937;
    box-shadow: 0 0 0 2px #3B82F6;
}

/* Checkboxes */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Arrays/Tags */
.array-input {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.array-input input {
    flex: 1;
}

.array-input button {
    padding: 8px 16px;
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.array-input button:hover {
    background: #2563EB;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag {
    background: #DBEAFE;
    color: #1E40AF;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tag button {
    background: none;
    border: none;
    color: #1E40AF;
    cursor: pointer;
    font-weight: bold;
}

.tag button:hover {
    color: #1E3A8A;
}

/* Sliders */
input[type="range"] {
    width: 100%;
    margin: 8px 0;
}

/* Panel JSON */
.json-panel {
    background: #1F2937;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 4px solid #3B82F6;
    display: flex;
    flex-direction: column;
    max-height: 800px;
}

.json-header {
    background: #2563EB;
    color: white;
    padding: 16px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.json-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.json-controls {
    display: flex;
    gap: 8px;
}

.json-controls button {
    padding: 6px 12px;
    background: white;
    color: #1F2937;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.json-controls button:hover {
    background: #F3F4F6;
}

/* Tabs del JSON */
.json-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #2563EB;
}

.json-tab {
    padding: 8px 12px;
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.json-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.json-tab.active {
    background: #7DD3FC;
    color: #1F2937;
}

/* Contenido JSON */
.json-content {
    flex: 1;
    padding: 16px;
    overflow: auto;
    background: #111827;
    border-radius: 0 0 8px 8px;
}

#json-display {
    color: #D1D5DB;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Tipos de datos */
.json-string { color: #10B981; }
.json-number { color: #F59E0B; }
.json-boolean { color: #8B5CF6; }
.json-null { color: #EF4444; }
.json-key { color: #60A5FA; }
.json-type-hint { color: #10B981; font-size: 10px; opacity: 0.7; margin-left: 8px; }

/* Info del JSON */
.json-info {
    background: #F3F4F6;
    padding: 12px 16px;
    border-radius: 0 0 8px 8px;
    border-top: 2px solid #3B82F6;
}

.json-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    font-size: 12px;
    color: #6B7280;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 32px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 16px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.footer p {
    color: #374151;
    font-weight: 500;
}

.footer p:first-child {
    margin-bottom: 8px;
}

.footer p:last-child {
    font-size: 12px;
    color: #6B7280;
}

/* Display del personaje */
#character-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    position: relative;
}

.character-name {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #FB923C;
    font-weight: bold;
    color: #EA580C;
}

.character-body {
    position: relative;
    margin-top: 60px;
}

.character-head {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #000;
    position: relative;
    margin: 0 auto;
    background: #FFDBAC;
}

.character-hair {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid #000;
}

.hair-basico { width: 140px; height: 80px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.hair-afro { width: 160px; height: 100px; border-radius: 50%; }
.hair-mohawk { width: 30px; height: 100px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.hair-calvo { display: none; }
.hair-largo { width: 140px; height: 120px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }

.character-eyes {
    position: absolute;
    top: 30px;
    left: 50%;
}

.eye {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    border: 2px solid #000;
    position: absolute;
}

.eye-left { left: 25px; }
.eye-right { right: 25px; }

.pupil {
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
}

.character-nose {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #FFB6C1;
    border-radius: 50%;
}

.character-mouth {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 12px;
    background: #FF69B4;
    border-radius: 50%;
    border: 2px solid #000;
}

.character-torso {
    width: 100px;
    height: 120px;
    margin: 8px auto;
    border: 4px solid #000;
    border-radius: 8px;
    position: relative;
    background: #FF0000;
}

.character-arms {
    position: absolute;
    top: 8px;
}

.arm {
    width: 20px;
    height: 80px;
    background: #FF0000;
    border: 4px solid #000;
    border-radius: 50px;
    position: absolute;
}

.arm-left { left: -40px; }
.arm-right { right: -130px; }

.character-legs {
    width: 100px;
    height: 80px;
    margin: 0 auto;
    border: 4px solid #000;
    border-radius: 8px;
    background: #0000FF;
    position: relative;
}

.character-feet {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.foot {
    width: 32px;
    height: 24px;
    background: #FFFFFF;
    border: 2px solid #000;
    border-radius: 8px;
}

.character-stats {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #3B82F6;
    font-size: 12px;
    display: flex;
    gap: 16px;
}

/* Animaciones */
@keyframes bounce-in {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.bounce-in {
    animation: bounce-in 0.6s ease-out;
}

/* Utilidades */
.hidden {
    display: none !important;
}

.visible {
    display: block;
}

/* Scrollbar personalizado */
.json-content::-webkit-scrollbar {
    width: 8px;
}

.json-content::-webkit-scrollbar-track {
    background: #374151;
}

.json-content::-webkit-scrollbar-thumb {
    background: #6B7280;
    border-radius: 4px;
}

.json-content::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .tabs {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .json-tabs {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .json-stats {
        grid-template-columns: 1fr;
    }
    
    .character-head {
        width: 100px;
        height: 100px;
    }
    
    .character-torso {
        width: 80px;
        height: 100px;
    }
}