:root {
    --gap: 1px;
    --margin-bottom: 4px;
    --margin-top: 4px;
    --padding-top: 8px;
    --padding-bottom: 8px;
}

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

body {
     font-family: 'TikTok sans','Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
     background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
     min-height: 100vh;
     padding: 5px;
 }

.container {
     max-width: 95%;
     margin: 0 auto;
     background: white;
     border-radius: 15px;
     box-shadow: 0 0 15px rgba(0,0,0,0.1);
     overflow: hidden;
 }

.header {
     background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
     color: white;
     padding: var(--padding-top) 15px var(--padding-bottom) 15px;
     text-align: center;
 }

.header h1 {
     font-size: 1.5rem;
     margin-bottom: 5px;
 }

.header p {
     font-size: 0.9rem;
     opacity: 0.9;
 }

.alert {
     padding: 10px;
     margin: 0;
     display: none;
     font-weight: 500;
 }

.alert.success {
     background-color: #d4edda;
     color: #155724;
     border-left: 4px solid #28a745;
 }

.alert.danger {
     background-color: #f8d7da;
     color: #721c24;
     border-left: 4px solid #dc3545;
 }

.alert.warning {
     background-color: #fff3cd;
     color: #856404;
     border-left: 4px solid #ffc107;
 }

.alert.info {
     background-color: #d1ecf1;
     color: #0c5460;
     border-left: 4px solid #17a2b8;
 }

.form-container {
     padding: var(--padding-top) 20px var(--padding-bottom) 20px;
 }

.form-group {
     margin-bottom: var(--margin-bottom);
 }
 .form-group.hidden2{
	 display: none;
 }
 .form-group.hidden3{
	 display: none;
 }
 
.form-row {
     display: grid;
    gap: var(--gap);
     align-items: end;
 }

.form-row.two-cols {
    grid-template-columns: 2fr auto;
 }

.form-row.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
 }

.form-row.four-cols {
    grid-template-columns: 1fr 1fr 1fr 2fr;
 }

.form-row.equal-cols {
    grid-template-columns: 1fr 1fr;
 }

.identification-name-row {
    display: grid;
    gap: var(--gap);
    align-items: end; /* Align items to the bottom */
    grid-template-columns: 1fr auto 2fr 1fr 2fr;
}

.identification-name-row .button-group .btn-validate {
    width: 100%;
}

label {
     display: block;
     margin-bottom: 5px;
     font-weight: 600;
     color:navy;/* #2c3e50;*/
     font-size: 0.9rem;
 }

.required {
     color: #e74c3c;
 }

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="email"],
select,
textarea {
     width: 100%;
     padding: 5px;
     border: 2px solid #ecf0f1;
     border-radius: 8px;
     font-size: 0.8rem;
     transition: all 0.3s ease;
     background: #fff;
 }

input:focus,
select:focus,
textarea:focus {
     outline: none;
     border-color: #3498db;
     box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
 }

.services-grid {
     display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 2px;
     margin-top: 5px;
 }

.service-item {
     background: #f8f9fa;
     border: 2px solid #ecf0f1;
     border-radius: 10px;
     padding: 8px 5px;
     text-align: center;
     cursor: pointer;
     transition: all 0.3s ease;
     min-height: 85px;
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
 }

.service-item:hover {
     background: #e3f2fd;
     border-color: #3498db;
     transform: translateY(-2px);
 }

.service-item.selected {
     background: #3498db;
     color: white;
     border-color: #2980b9;
}

.main-service-item.selected {
    background: #e3f2fd;
    color: #2980b9;
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}

.service-item i {
     font-size: 1.5rem;
     margin-bottom: 6px;
     display: block;
}

/* --- Colores de Iconos --- */
.icon-odd { color: navy !important; }
.icon-even { color: goldenrod !important; }
.sub-icon-odd { color: black !important; }
.sub-icon-even { color: purple !important; }

/* Al seleccionar un sub-servicio, el texto se vuelve blanco, pero el icono mantiene su color gracias a !important */
.sub-service-item.selected {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.service-item span {
     font-size: 0.75rem;
     font-weight: 500;
     line-height: 1.1;
 }

.datetime-group {
     display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;/*var(--gap);*/
 }

.btn-validate {
     background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
     color: white;
     border: none;
     border-radius: 8px;
     padding: 10px 15px;
     font-size: 0.9rem;
     font-weight: 600;
     cursor: pointer;
     transition: all 0.3s ease;
     white-space: nowrap;
     height: 44px; /* Match input height */
 }

.btn-validate:hover:not(:disabled) {
     background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
     transform: translateY(-1px);
 }

.btn-validate:disabled {
     opacity: 0.6;
     cursor: not-allowed;
 }

.device-section {
     background: #f8f9fa;
     border-radius: 10px;
     padding: 6px;
     margin-bottom: 2px;
     border-left: 4px solid #3498db;
     cursor: pointer;
     transition: background-color 0.3s ease, border-color 0.3s ease;
 }

.device-section h4 {
     color:#2c3e50;
     margin-bottom: var(--margin-bottom);
     font-size: 0.95rem;
     display: flex;
     align-items: center;
 }

.device-section h4 i {
     margin-right: 8px;
     color: #3498db;
 }

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

.char-counter {
     text-align: right;
     font-size: 0.5rem;
     color: #7f8c8d;
     margin-top: 1px;
 }

.btn {
     width: 100%;
     padding: 12px;
     border: none;
     border-radius: 10px;
     font-size: 1.1rem;
     font-weight: 600;
     cursor: pointer;
     transition: all 0.3s ease;
     margin-top: var(--margin-top);
 }

.btn-primary {
     background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
     color: white;
 }

.btn-primary:hover:not(:disabled) {
     transform: translateY(-2px);
     box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
 }

.btn:disabled {
     opacity: 0.6;
     cursor: not-allowed;
 }

.hidden {
     display: none;
 }


.loading {
     position: relative;
 }

.loading::after {
     content: '';
     position: absolute;
     top: 50%;
     left: 50%;
     width: 20px;
     height: 20px;
     margin: -10px 0 0 -10px;
     border: 2px solid transparent;
     border-top: 2px solid #fff;
     border-radius: 50%;
     animation: spin 1s infinite;
 }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.consultation-notice {
     background: #e3f2fd;
     border: 1px solid #3498db;
     border-radius: 8px;
     padding: 10px;
     margin-bottom: var(--margin-bottom);
 }

.consultation-notice h3 {
     color: #2980b9;
     margin-bottom: 8px;
     font-size: 1rem;
 }

.consultation-notice p {
     color: #34495e;
     font-size: 0.9rem;
     line-height: 1.4;
 }

.coupon-notice {
    background: #e6ffed;
    border: 1px solid #5cb85c;
    border-radius: 8px;
    padding: 10px;
}

.coupon-notice h3 {
    color: #3d8b3d;
    margin-bottom: 8px;
    font-size: 1rem;
}

.coupon-notice p {
    color: #34495e;
    font-size: 0.9rem;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .container {
         margin: 3px;
         border-radius: 10px;
         max-width: 98%;
     }

    .header {
         padding: 15px;
     }

    .form-container {
         padding: 15px 20px;
     }

    .identification-name-row {
        grid-template-columns: 1fr;
    }

    .form-row.two-cols,
    .form-row.three-cols,
    .form-row.four-cols,
    .form-row.equal-cols {
        grid-template-columns: 1fr;
        gap: var(--gap);
     }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
     }

    .datetime-group {
        grid-template-columns: 1fr;
     }

    .service-item {
         min-height: 80px;
         padding: 10px 6px;
     }

    .service-item i {
         font-size: 1.4rem;
     }

    .service-item span {
         font-size: 0.7rem;
     }
}

.device-details-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr 1.5fr 2fr;
    gap: var(--gap);
    align-items: start;
}

/* No longer needed, as it's now a column in the grid */
/* .device-details-row .service-selection-group {
    grid-column: 1 / -1; 
} */


@media (max-width: 768px) {
    .device-details-row {
        grid-template-columns: 1fr;
     }
}

.device-section.selected-device {
     background-color: beige;
     border-color: orange;
     box-shadow: 0 0 0 3px rgba(216, 180, 0, 0.3);
 }

.device-service-selector {
     display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 3px;
    margin-top: var(--margin-top);
 }
@media (min-width: 1200px) {
    .services-grid {
        grid-template-columns: repeat(8, 1fr);
     }
    .device-service-selector {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
     }

    body {
         padding: 5px 5px;
     }
}

.notice-row {
     display: flex;
    gap: var(--gap);
     margin-bottom: var(--margin-bottom);
 }

.notice-row .consultation-notice,
.notice-row .coupon-notice {
     flex: 1;
     margin-bottom: 0;
 }

@media (max-width: 768px) {
    .notice-row {
         flex-direction: column;
     }
    .notice-row .consultation-notice,
    .notice-row .coupon-notice    {
         margin-bottom: var(--margin-bottom);
     }
}

/* New Styles for Service Tags */
.selected-services-container {
  display: flex;
  flex-wrap: wrap;
	flex-direction: row;
  gap: 3px;
  padding: 10px;
  background-color: #fff;
  border: 2px solid #ecf0f1;
  border-radius: 8px;
  min-height: 40px;
	width: max-content;
	max-width: 440px;
  font-size:14px;
}

.no-services-text {
    color:#7f8c8d;
    font-size: 0.9rem;
    align-self: center;
}

.service-tag {
    display: inline-flex;
    align-items: center;
    background-color: #3498db;
    color: white;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.9rem;
    font-weight: 200;
}

.service-tag-remove {
    margin-left: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.service-tag-remove:hover {
    color: #e74c3c;
}

/* --- Service Icon Colors --- */
.service-icon-color-1 { color: #3498db; } /* Blue */
.service-icon-color-2 { color: #2ecc71; } /* Green */
.service-icon-color-3 { color: #e67e22; } /* Orange */
.service-icon-color-4 { color: #9b59b6; } /* Purple */
.service-icon-color-5 { color: #1abc9c; } /* Teal */
.service-icon-color-6 { color: #e74c3c; } /* Red */
.service-icon-color-7 { color: #f1c40f; } /* Yellow */
.service-icon-color-8 { color: #34495e; } /* Dark Blue/Grey */

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-content {
    flex-grow: 1;
    padding-bottom: 15px; /* Space for footer */
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.modal-footer .btn {
    width: auto; /* Override full width button style */
    padding: 8px 15px;
    font-size: 0.9rem;
    border-radius: 5px;
}

.modal-footer .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.modal-footer .btn-secondary:hover {
    background-color: #5a6268;
}

/* Utility class */
.hidden {
    display: none !important;
}

/* Toast Styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001; /* Above modal */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-message {
    background-color: #333;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    animation: fadeIn 0.3s forwards, fadeOut 0.5s 3s forwards; /* Fade in, stay, fade out */
}

.toast-message.success { background-color: #28a745; }
.toast-message.danger { background-color: #dc3545; }
.toast-message.warning { background-color: #ffc107; color: #333; }
.toast-message.info { background-color: #17a2b8; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* --- Nuevos Estilos para Menú de 2 Niveles --- */

.services-grid-container {
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 8px;
}

.main-services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 4px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px dashed #ecf0f1;
}

.sub-services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0px;
    min-height: 80px; /* Evita que el layout salte al cambiar de contenido */
}

.sub-services-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #7f8c8d;
    font-size: 0.9rem;
    grid-column: 1 / -1; /* Ocupa todo el ancho del grid */
    text-align: center;
}

/* Hereda de .service-item pero con borde diferente para el estado seleccionado */
.main-service-item.selected {
    background: #e3f2fd; /* Un color de fondo más suave para la categoría activa */
    color: #2980b9; /* Texto oscuro para contraste */
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}

/* Colores para los iconos de servicios principales */
.icon-odd {
    color: navy;
}
.icon-even {
    color: goldenrod;
}

/* Estilo para los subservicios seleccionados (igual que el .service-item.selected original) */
.sub-service-item.selected {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.sub-service-item.selected i {
    color: white;
}
