/**
 * Archivo: views/css/stringing.css
 * Estilos para el módulo de encordado Fomplay
 */

/* ======================
   Contenedor principal
   ====================== */
.fomplay-stringing-wrapper {
    margin: 20px 0;
}

/* ======================
   Botón de Cordaje
   ====================== */
.fomplay-stringing-button-container {
    margin-bottom: 15px;
}

.fomplay-btn-stringing {
    background-color: #1f4872 !important;
    border-color: #1f4872 !important;
    color: #fff;
    font-weight: 600;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    width: auto;
    justify-content: center;
    font-family: "Chakra Petch", sans-serif;
    text-transform: uppercase;
}

.fomplay-btn-stringing:hover {
    background-color: #25a0ba;
    border-color: #25a0ba;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(47, 181, 210, 0.3);
}

.fomplay-btn-stringing .material-icons {
    font-size: 20px;
}

/* Estilo para botón de añadir al carrito deshabilitado */
button.disabled,
button:disabled,
button[disabled] {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ======================
   Resumen de configuración
   ====================== */
.fomplay-stringing-summary {
    background: #f8f9fa;
    border: 2px solid #212121;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.stringing-summary-content h4 {
    color: #212121;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    border-bottom: 2px solid #212121;
    padding-bottom: 8px;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #212121;
    padding-bottom: 8px;
}

.summary-header h4 {
    margin: 0;
    border: none;
    padding: 0;
}

#remove-stringing-btn {
    color: #dc3545;
    font-size: 14px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

#remove-stringing-btn:hover {
    color: #c82333;
    text-decoration: none;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
}

#remove-stringing-btn .material-icons {
    font-size: 18px;
}

.summary-details {
    margin-bottom: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 500;
    color: #555;
}

.summary-value {
    font-weight: 600;
    color: #333;
}

.summary-total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #212121 !important;
    font-size: 18px;
}

.summary-total .summary-value {
    color: #212121;
}

#edit-stringing-btn {
    margin-top: 10px;
}

/* ======================
   Checkbox de términos
   ====================== */
.stringing-terms-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.custom-checkbox {
    display: contents;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    padding-left: 30px;
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox .checkmark {
    position: absolute;
    left: 0;
    top: 0;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: #2fb5d2;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #2fb5d2;
    border-color: #2fb5d2;
}

.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid black;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.terms-link {
    color: #2fb5d2;
    text-decoration: underline;
    margin-left: 5px;
}

.terms-link:hover {
    color: #25a0ba;
}

/* ======================
   Modal
   ====================== */
#fomplay-stringing-modal .modal-dialog {
    max-width: 900px;
}

#fomplay-stringing-modal .modal-header {
    background-color: #000000;
    color: white;
}

#fomplay-stringing-modal .modal-title {
    font-weight: 700;
    font-size: 22px;
}

#fomplay-stringing-modal .close {
    color: white;
    opacity: 1;
}

/* ======================
   Grid de cordajes
   ====================== */
.strings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.string-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
    position: relative;
}

.string-item:hover {
    border-color: #ffd400;
    box-shadow: 0 4px 12px rgba(255, 224, 0, 0.3);
    transform: translateY(-3px);
}

.string-item.selected {
    border-color: #ffd400;
    background: #fbfbf0;
    box-shadow: 0 0 15px rgba(255, 224, 0, 0.3);
}

.string-item.selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #127806;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    animation: checkmark-pop 0.3s ease;
}

@keyframes checkmark-pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.string-image {
    margin-bottom: 12px;
    pointer-events: none;
    position: relative;
}

.string-image img {
    max-width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 4px;
}

/* Badge de stock bajo */
.stock-badge {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    animation: pulse-badge 2s infinite;
}

.stock-badge.stock-low {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 87, 34, 0.4);
}

.stock-badge i {
    font-size: 14px;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

/* Mensaje de sin cordajes disponibles */
.no-strings-available {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.no-strings-available p {
    margin: 10px 0;
    color: #666;
}

.no-strings-available p:first-child {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.string-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    pointer-events: none;
}

.string-price {
    font-size: 18px;
    font-weight: 700;
    color: #127806;
    margin-bottom: 10px;
    pointer-events: none;
}

.select-string-btn {
    width: 100%;
    background-color: #212121;
    border-color: #212121;
    pointer-events: none;
    transition: all 0.3s ease;
}

.string-item:hover .select-string-btn {
    background-color: #212121;
    border-color: #212121;
}

.string-item.selected .select-string-btn {
    background-color: #28a745;
    border-color: #28a745;
}

.string-item.selected .select-string-btn:after {
    content: " ✓";
}

/* ======================
   Configuración de tensión
   ====================== */
.tension-configuration {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.tension-main-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 25px;
    font-size: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mensaje de advertencia de tensión */
.tension-warning-alert {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #ff9800;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
    animation: slideInDown 0.5s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tension-warning-alert i {
    font-size: 24px;
    color: #ff9800;
    flex-shrink: 0;
}

.tension-warning-alert strong {
    color: #d84315;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tension-sliders-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 20px;
}

.tension-slider-group {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 5px;
}

.label-left,
.label-right {
    font-weight: 600;
}

.tension-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 15px;
    cursor: pointer;
}

.tension-slider::-webkit-slider-track {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
}

.tension-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
}

.tension-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ff6b35;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.tension-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(255,107,53,0.5);
}

.tension-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.tension-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ff6b35;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.tension-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(255,107,53,0.5);
}

.tension-slider::-moz-range-thumb:active {
    transform: scale(1.1);
}

/* Segundo slider con color diferente */
#tension-vertical::-webkit-slider-thumb {
    background: #ff8c35;
}

#tension-vertical::-moz-range-thumb {
    background: #ff8c35;
}

.tension-value-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #ff6b35;
}

#tension-vertical + .tension-value-box {
    border-left-color: #ff8c35;
}

.tension-value-number {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    min-width: 55px;
}

.tension-unit {
    font-size: 16px;
    color: #666;
    font-weight: 600;
}

.tension-description {
    font-size: 13px;
    color: #666;
    margin-left: auto;
}

.tension-range-note {
    text-align: center;
    display: block;
    margin-top: 15px;
    font-size: 13px;
}

.tension-control {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 250px;
}

.tension-control input {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
}

.tension-control button {
    width: 40px;
    height: 40px;
    font-size: 20px;
    font-weight: 700;
    padding: 0;
}

/* ======================
   Servicios adicionales
   ====================== */
.extra-services {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-control {
    margin-bottom: 0;
    position: relative;
}

.custom-control-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-control-label {
    font-weight: 500;
    color: #555;
    cursor: pointer;
    padding: 12px 15px;
    padding-left: 45px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background-color: #fff;
    display: block;
    position: relative;
    transition: all 0.3s ease;
    user-select: none;
}

.custom-control-label:hover {
    border-color: #ffd400;
    background-color: #fff6cb;
}

/* Checkbox personalizado */
.custom-control-label:before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.3s ease;
}

/* Checkmark */
.custom-control-label:after {
    content: "";
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 3px 3px 0;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Estado checked */
.custom-control-input:checked ~ .custom-control-label {
    background-color: #fff6cb;
    border-color: #ffd400;
    color: #212121;
    font-weight: 600;
}

.custom-control-input:checked ~ .custom-control-label:before {
    background-color: #ffd400;
    border-color: #ffd400;
}

.custom-control-input:checked ~ .custom-control-label:after {
    opacity: 1;
}

/* Efecto de focus */
.custom-control-input:focus ~ .custom-control-label {
    box-shadow: 0 0 0 3px rgba(47, 181, 210, 0.2);
}

/* Estado deshabilitado (cuando 4 nudos es obligatorio) */
.custom-control-input:disabled ~ .custom-control-label {
    opacity: 0.7;
    cursor: not-allowed;
}

.custom-control-input:disabled:checked ~ .custom-control-label {
    background-color: #fff6cb;
    border-color: #2fb5d2;
}

.custom-control-input:disabled:checked ~ .custom-control-label:before {
    background-color: #2fb5d2;
}

/* Texto del precio */
.custom-control-label .price-badge {
    float: right;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

/* ======================
   Resumen de precio en modal
   ====================== */
.modal-price-summary {
    background: white;
    border: 2px solid #212121;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 15px;
}

.price-row > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#modal-extras-detail {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 2px;
}

.price-total {
    border-top: 2px solid #212121;
    margin-top: 8px;
    padding-top: 12px !important;
    font-size: 18px;
    color: #212121;
}

/* ======================
   Botones del modal
   ====================== */
#fomplay-stringing-modal .modal-footer {
    border-top: 2px solid #e0e0e0;
}

#save-stringing-config {
    background-color: #28a745;
    border-color: #28a745;
    font-weight: 600;
    border-radius: 50px;
}

#save-stringing-config:hover {
    background-color: #218838;
    border-color: #218838;
}

.modal-footer .btn-secondary {
    border-radius: 50px;
}

/* ======================
   Responsive
   ====================== */
@media (max-width: 768px) {
    .strings-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .string-image img {
        height: 120px;
    }

    .summary-item {
        flex-direction: column;
        gap: 5px;
    }

    .fomplay-stringing-summary {
        padding: 15px;
    }

    .tension-slider-group {
        padding: 15px;
    }

    .tension-value-number {
        font-size: 24px;
    }

    .tension-description {
        font-size: 11px;
    }
}

@media (max-width: 576px) {
    .strings-grid {
        grid-template-columns: 1fr;
    }

    .fomplay-btn-stringing {
        width: 100%;
        justify-content: center;
    }

    .tension-main-title {
        font-size: 16px;
    }

    .tension-value-box {
        flex-wrap: wrap;
    }

    .tension-description {
        width: 100%;
        margin-left: 0;
        margin-top: 5px;
    }
}