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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
}

/* Panel de Configuración */
.config-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.config-panel h2 {
    margin-bottom: 24px;
    color: #1d1d1f;
    font-size: 24px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1d1d1f;
}

.form-group p {
    margin-bottom: 12px;
    color: #86868b;
    font-size: 14px;
}

/* Tipos de Pase */
.pass-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.pass-type {
    border: 2px solid #e5e5e7;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.pass-type:hover {
    border-color: #007aff;
    transform: translateY(-2px);
}

.pass-type.selected {
    border-color: #007aff;
    background: #f0f8ff;
}

.pass-type .icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.pass-type .label {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 12px;
}

.pass-type .category {
    font-size: 10px;
    color: #007aff;
    font-weight: 600;
    text-transform: uppercase;
}

/* Campos de Formulario */
input[type="text"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #007aff;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.btn-primary {
    background: #007aff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.btn-primary:hover {
    background: #0056cc;
}

/* Panel de Vista Previa */
.preview-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow: hidden;
}

.preview-panel h2 {
    margin-bottom: 24px;
    color: #1d1d1f;
    font-size: 24px;
    font-weight: 600;
}

/* Marco del Dispositivo */
.device-frame {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.device-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.device-btn {
    padding: 8px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.device-btn.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

.device-container {
    position: relative;
    display: inline-block;
}

.device-frame-svg {
    width: 250px !important;
    height: auto !important;
    display: block !important;
}

/* Sobrescribir cualquier regla que afecte el frame */
#deviceFrame {
    width: 350px !important;
    height: auto !important;
    display: block !important;
    flex: none !important;
}



.screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 520px;
    background: transparent;
    border-radius: 25px;
    overflow: hidden;
}

/* Ajustes específicos para cada dispositivo */
.device-container[data-device="ios"] .screen {
    width: 325px;
    height: 520px;
    border-radius: 25px;
}

.device-container[data-device="android"] .screen {
    width: 325px;
    height: 580px;
    border-radius: 15px;
}

.pass-container {
    padding: 0;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: transparent;
    padding-top: 30px;
}

.pass-container .pass {
    width: 90%;
    max-width: 280px;
    height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,.12), 10px 0 15px rgba(0,0,0,.08), -10px 0 15px rgba(0,0,0,.08);
    overflow: hidden;
}

.pass-container .placeholder {
    width: 90%;
    max-width: 280px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

.placeholder p {
    text-align: center;
    color: #86868b;
    padding: 20px;
    margin: 0;
    font-size: 14px;
}

/* Selector de Código de Barras */
.barcode-selector {
    margin: 15px 0;
    text-align: center;
}

.barcode-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1d1d1f;
}

.barcode-selector select {
    padding: 8px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-size: 14px;
}

.preview-note {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    margin-top: 15px;
}

.preview-note p {
    color: #1976d2;
    font-size: 14px;
    margin: 0;
}

/* Selectores de Color */
.color-settings {
    background: #f8f9fa;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.color-settings h4 {
    margin: 0 0 15px 0;
    color: #1d1d1f;
    font-size: 16px;
    font-weight: 600;
}

.color-selectors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.color-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.color-selector label {
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 8px;
    font-size: 14px;
}

.color-selector input[type="color"] {
    width: 50px;
    height: 50px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: border-color 0.2s ease;
}

.color-selector input[type="color"]:hover {
    border-color: #007aff;
}

.color-selector input[type="color"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.color-description {
    font-size: 12px;
    color: #86868b;
    line-height: 1.3;
}

/* Campos Dinámicos */
.field-section {
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.field-section h4 {
    margin-bottom: 12px;
    color: #1d1d1f;
    font-size: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.field-input {
    display: flex;
    flex-direction: column;
}

.field-input label {
    font-size: 12px;
    color: #86868b;
    margin-bottom: 4px;
}

.field-input input {
    padding: 8px;
    font-size: 14px;
}

/* Contenedor para input + controles (requerido + no usar) */
.field-input-with-required {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex: 1;
}

.field-input-with-required .field-input {
    flex: 1;
}

/* Contenedor para los controles (requerido + no usar) */
.field-controls {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.2rem;
}

/* Checkbox de requerido */
.required-checkbox {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.required-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: #666;
    margin: 0;
}

.required-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
    height: auto;
}

/* Checkbox de no usar */
.hide-checkbox {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.hide-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: #d32f2f;
    margin: 0;
}

.hide-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
    height: auto;
}

/* Header de sección con checkbox grupal */
.field-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.field-section-header h4 {
    margin: 0;
}

/* Checkbox grupal "No Usar" */
.group-hide-checkbox {
    display: flex;
    align-items: center;
}

.group-hide-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #d32f2f;
    margin: 0;
    cursor: pointer;
}

.group-hide-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
    height: auto;
    cursor: pointer;
}

/* Sección oculta por checkbox grupal */
.field-section.section-hidden {
    opacity: 0.5;
    pointer-events: none;
}

.field-section.section-hidden .field-row {
    display: none;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #9ca3af;
}

.breadcrumb-current {
    color: #1f2937;
    font-weight: 600;
}

/* Pass Type Header */
.pass-type-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.pass-type-icon {
    font-size: 3rem;
}

.pass-type-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.pass-type-info p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* Error Messages */
.error-messages {
    margin-bottom: 2rem;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.close {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #6b7280;
}

.close:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

#jsonOutput {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Device Selector */
.device-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.device-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.device-selector label:hover {
    border-color: #667eea;
}

.device-selector input[type="radio"] {
    margin: 0;
}

.device-selector input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.device-selector label:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #f0f8ff;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }

    .iphone-frame {
        width: 250px;
        height: 500px;
    }
}
