/* ============================================
   DISEÑO MOBILE-FIRST MODERNO
   ============================================ */

* {
    box-sizing: border-box;
}

.uid-app {
    max-width: 500px;
    margin: 0 auto;
    padding: 12px;
    padding-bottom: 80px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header */
.uid-header {
    text-align: center;
    margin-bottom: 16px;
}

.uid-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 8px 0;
}

/* Toast de estado */
.uid-toast {
    display: block;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    text-align: center;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.uid-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
}

.uid-card-highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.uid-card-highlight .uid-label {
    color: rgba(255,255,255,0.9);
}

.uid-card-highlight .uid-input-readonly {
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 1px;
    border: 2px dashed rgba(255,255,255,0.4);
}

.uid-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f3f4f6;
}

/* Campos */
.uid-field {
    margin-bottom: 12px;
    width: 100%;
}

.uid-field:last-child {
    margin-bottom: 0;
}

.uid-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.uid-optional {
    font-weight: 400;
    text-transform: none;
    color: #9ca3af;
    font-size: 0.75rem;
}

.uid-readonly-value {
    display: block;
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
}

/* Inputs */
.uid-input {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    font-size: 16px; /* Evita zoom en iOS */
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    color: #1f2937;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.uid-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.uid-input::placeholder {
    color: #9ca3af;
}

.uid-input-readonly {
    cursor: default;
}

.uid-textarea {
    resize: vertical;
    min-height: 80px;
    width: 100% !important;
    max-width: 100% !important;
    display: block;
}

.uid-input-price {
    text-align: right;
    font-weight: 600;
}

/* Select */
.uid-select-wrapper {
    position: relative;
}

.uid-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
    background-size: 20px;
    color: #1f2937;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.uid-select:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
}

/* Badge de estado */
.uid-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.uid-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.uid-badge-success {
    background: #d1fae5;
    color: #065f46;
}

/* Grupo de búsqueda */
.uid-search-group {
    display: flex;
    gap: 8px;
}

.uid-search-group .uid-input {
    flex: 1;
    min-width: 0;
}

.uid-search-group .uid-btn {
    flex-shrink: 0;
    width: 52px;
    padding: 14px;
    font-size: 1.2rem;
}

/* Preview producto */
.uid-product-preview {
    margin-top: 12px;
    text-align: center;
}

.uid-product-img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Grid de precios */
.uid-price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.uid-price-ref {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.uid-field-inline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.uid-label-small {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
}

.uid-input-mini {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.8rem;
    border: none;
    background: #f3f4f6;
    border-radius: 6px;
    color: #6b7280;
    min-width: 0;
    display: block;
}

/* Upload de imágenes */
.uid-upload-area {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.uid-upload-area:active {
    background: #f3f4f6;
    border-color: #667eea;
}

.uid-upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.uid-upload-text {
    display: block;
    font-size: 0.9rem;
    color: #6b7280;
}

.uid-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Grid de imágenes */
.uid-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.uid-image-item {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px;
    background: #ffffff;
    text-align: center;
}

.uid-image-item.dragging {
    opacity: 0.6;
    border-color: #667eea;
}

.uid-image-preview {
    width: 100%;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
}

.uid-image-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 6px;
}

.uid-image-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.uid-image-btn-rotate {
    background: #667eea;
}

.uid-image-btn-delete {
    background: #dc3545;
}

.uid-image-btn:hover {
    opacity: 0.9;
}

/* Botones */
.uid-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.uid-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.uid-btn-primary:hover,
.uid-btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.uid-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    flex: 1;
}

.uid-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.uid-btn-block {
    width: 100%;
    margin-top: 12px;
}

/* Botones de acción fijos */
.uid-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    z-index: 100;
}

.uid-actions-spacer {
    height: 70px;
}

/* ============================================
   RESPONSIVE - TABLETS Y DESKTOP
   ============================================ */

@media screen and (min-width: 768px) {
    .uid-app {
        padding: 24px;
        max-width: 700px;
    }

    .uid-header h1 {
        font-size: 1.8rem;
    }

    .uid-card {
        padding: 24px;
        margin-bottom: 16px;
    }

    .uid-actions {
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 20px 0;
        max-width: 700px;
        margin: 0 auto;
    }

    .uid-actions-spacer {
        display: none;
    }
}

@media screen and (min-width: 1024px) {
    .uid-app {
        max-width: 800px;
        padding: 32px;
    }

    .uid-card {
        padding: 28px;
    }

    .uid-actions {
        max-width: 800px;
    }

    /* Grid de precios más amplio en desktop */
    .uid-price-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    .uid-price-ref {
        border-top: none;
        padding-top: 0;
    }
}

/* ============================================
   SOPORTE PARA MODO OSCURO (opcional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .uid-app {
        background: #1a1a2e;
    }

    .uid-header h1 {
        color: #f3f4f6;
    }

    .uid-card {
        background: #16213e;
        border-color: #2a2a4a;
    }

    .uid-card-title {
        color: #e5e7eb;
        border-color: #2a2a4a;
    }

    .uid-label {
        color: #9ca3af;
    }

    .uid-input,
    .uid-select {
        background: #1a1a2e;
        border-color: #2a2a4a;
        color: #f3f4f6;
    }

    .uid-input:focus,
    .uid-select:focus {
        background: #16213e;
    }

    .uid-upload-area {
        background: #1a1a2e;
        border-color: #2a2a4a;
    }

    .uid-actions {
        background: #16213e;
        border-color: #2a2a4a;
    }
}
