/* Estilos para campos repetidores */
.gd-repeater {
    margin: 1em 0;
    border-top: 1px solid #e0e0e0; 
}

/* ===== UPLOAD PERSONALIZADO ===== */
.gd-media-field {
    position: relative;
    margin-bottom: 1rem;
}

.gd-media-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #91b508;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.gd-media-upload:hover {
    background: #7a9a07;
    transform: translateY(-1px);
}

.gd-media-upload:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.upload-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.gd-media-preview {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.gd-media-preview.multiple {
    flex-direction: row;
}

.file-preview {
    position: relative;
    display: inline-block;
    max-width: 150px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    padding: 0.5rem;
    background: #f9f9f9;
}

.file-preview img {
    width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #91b508;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.file-name {
    display: block;
    margin-top: 0.5rem;
    font-size: 12px;
    color: #666;
    word-break: break-word;
}

.remove-file-btn {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 20px;
    height: 32px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn:hover {
    background: #c0392b;
}

.gd-media-remove {
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: none;
}

.gd-media-remove:hover {
    background: #c0392b;
}

.gd-repeater-label {
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
    color: #333;
}

.gd-repeater-item {
    display: flex;
    padding: 0.5em 0;
    align-items: center;
    gap: 15px;
    background: #fff;
}

.gd-repeater-item:last-child {
    border-bottom: none;
}

.gd-repeater-template {
    display: none !important;
}

.gd-repeater-field {
    flex: 1;
    min-width: 0;
}
.gd-repeater-field .gd-label {
    padding: 0;  
    font-size: 14px;
    font-weight: normal !important;
}

.gd-repeater-field.gd-field-costo {
    flex: 0 0 120px;
}

.gd-repeater-field.gd-field-unidad {
    flex: 0 0 140px;
}

.gd-repeater-field.gd-field-precio {
    flex: 0 0 140px;
}

/* Estilos específicos para formulario de cliente basados en Figma */
.gd-form-cliente {
    font-family: 'Montserrat', sans-serif;
    background: #ffffff;
}

.gd-form-cliente .crear-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.gd-form-cliente .crear-topbar-titulo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1.6;
    color: #000000;
    margin: 0;
}


/* Grupos de campos */
.gd-form-cliente .crear-grupo-titulo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 23px;
    line-height: 1.6;
    color: #000000;
    margin: 2rem 0 1rem 0;
    padding-top: 1.5rem;
}

.gd-form-cliente .crear-grupo-titulo:first-child {
    border-top: none;
    padding-top: 0;
}

/* Campos del formulario */


/* Layout responsive de columnas */
.gd-form-cliente .gd-row {
    display: flex;
    gap: 15px;
    margin-bottom: 1rem;
}

.gd-form-cliente .gd-field {
    margin-bottom: 1rem;
}

.gd-col {
    flex: 1;
}

.gd-col-2 {
    flex: 0 0 calc(50% - 7.5px);
}

.gd-col-3 {
    flex: 0 0 calc(33.333% - 10px);
}

.gd-col-4 {
    flex: 0 0 calc(25% - 11.25px);
}

/* Switch activo/inactivo */
.gd-switch {
    position: relative;
    display: inline-block;
    width: 49px;
    height: 32px;
}

.gd-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gd-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 100px;
}

.gd-switch-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    right: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.gd-switch input:checked + .gd-switch-slider {
    background-color: #91b508;
}

.gd-switch input:checked + .gd-switch-slider:before {
    transform: translateX(-17px);
}

/* Repetidores específicos para cliente */
.gd-form-cliente .gd-repeater {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    background: #f9f9f9;
}

.gd-form-cliente .gd-label-section {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 23px;
    line-height: 1.6;
    color: #000000;
    margin-bottom: 1rem;
    display: block;
}

.gd-form-cliente .gd-repeater-item {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.gd-form-cliente .gd-repeater-field {
    min-width: 0;
}

.gd-form-cliente .gd-repeater-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.gd-form-cliente .gd-repeater-add,
.gd-form-cliente .gd-repeater-remove {
    width: 45px;
    height: 45px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gd-form-cliente .gd-repeater-add {
    background: #91b508;
    color: white;
}

.gd-form-cliente .gd-repeater-remove {
    background: #d3d3d3;
    color: #666;
}

.gd-form-cliente .gd-repeater-add:hover {
    background: #7a9607;
}

.gd-form-cliente .gd-repeater-remove:hover {
    background: #b8b8b8;
}

/* Campos con iconos */
.gd-form-cliente .gd-field-with-icon {
    position: relative;
}

.gd-form-cliente .gd-field-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.gd-form-cliente .gd-field-with-icon .gd-input {
    padding-left: 50px;
}

.gd-repeater-field.gd-field-servicio,
.gd-repeater-field.gd-field-cliente {
    flex: 2;
}

.gd-repeater-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding-top: 6px;
}

.gd-repeater-remove {
    background: #898989 !important;
}

.gd-repeater-add,
.gd-repeater-remove {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    display: flex ;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    font-weight: bold !important;
    transition: all 0.2s ease !important;
}

.gd-repeater-add {
    background: #7ED321;
    color: white;
}

.gd-repeater-add:hover {
    background: #6BC113;
    transform: scale(1.05);
}

.gd-repeater-remove {
    background: #d32f2f;
    color: white;
}

.gd-repeater-remove:hover {
    background: #b71c1c;
    transform: scale(1.05);
}

/* Separadores */
.gd-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 30px 0;
    border: none;
}

.gd-separator-label {
    text-align: center;
    margin: 30px 0 20px 0;
    position: relative;
}

.gd-separator-label::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.gd-separator-label span {
    background: #fff;
    padding: 0 20px;
    color: #666;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Estilos para select2 en repetidores */
.gd-repeater-item .select2-container {
    width: 100% !important;
}

.gd-repeater-item .select2-selection {
    height: 48px !important;
    border: 2px solid #7ED321 !important;
    border-radius: 8px !important;
}

.gd-repeater-item .select2-selection__rendered {
    line-height: 44px !important;
    padding-left: 12px !important;
}

.gd-repeater-item .select2-selection__arrow {
    top: 50% !important;
    transform: translateY(-50%);
    right: 10px !important;
}

/* Campos con íconos - solo para formulario de plantas */
.gd-form-planta .gd-field-with-icon {
    position: relative;
}

/* Iconos específicos por campo */
.gd-field-with-icon .gd-input {
    padding-left: 40px !important;
}

/* Fallback para navegadores que no soportan :has() */
.gd-form-planta .gd-field-with-icon .gd-field-icon {
    position: absolute;
    left: 12px;
    top: 40%;
    transform: translateY(-50%);
    color: #7ED321;
    font-size: 16px;
    z-index: 2;
    pointer-events: none;
    margin-top: 24px; /* Para alinear con el label */
}

/* Estilos específicos para formulario de plantas */
.gd-form-planta .gd-input,
.gd-form-planta .gd-select,
.gd-form-planta .gd-textarea {
    border-radius: 8px;
    height: 48px;
    padding: 12px;
    font-size: 14px;
}

.gd-textarea {
    height: auto;
    min-height: 120px !important;
    resize: vertical;
}

/* Layout del formulario de plantas */
.gd-form-planta__topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
}

.gd-form-planta__titulo {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.gd-form-planta__footer {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}


/* Responsive */
@media (max-width: 768px) {
    .gd-repeater-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .gd-repeater-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .gd-repeater-field.gd-field-costo,
    .gd-repeater-field.gd-field-unidad,
    .gd-repeater-field.gd-field-precio {
        flex: 1;
    }
    
    .gd-row {
        flex-direction: column;
    }
    
    .gd-col-2 {
        flex: 1;
    }
    
    .gd-form-planta__topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .gd-form-planta__footer {
        flex-direction: column-reverse;
    }
}

/* Media Upload Field */
.gd-media-field {
    margin-bottom: 1rem;
}

.gd-media-preview {
    min-height: 60px;
    border: 2px dashed #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    transition: border-color 0.3s ease;
}

.gd-media-preview:hover {
    border-color: #91B508;
}

.gd-media-preview img {
    max-height: 80px;
    max-width: 100%;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gd-media-preview .gd-file-icon {
    background: #91B508;
    color: white;
    padding: 10px 15px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.gd-media-preview:empty::before {
    content: 'No hay archivos seleccionados';
    color: #666;
    font-style: italic;
}

.gd-media-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gd-media-buttons .gd-button {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
}

.gd-media-upload {
    background: #91B508;
    color: white;
}

.gd-media-upload:hover {
    background: #7a9607;
}

.gd-media-remove {
    background: #dc3545;
    color: white;
}

.gd-media-remove:hover {
    background: #c82333;
}

/* Multiple files preview */
.gd-media-preview.multiple {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
}

.gd-media-preview.multiple img,
.gd-media-preview.multiple .gd-file-icon {
    margin: 0;
}