/* Shared styles for services and related views */
body {
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #222;
}

.header {
    background: #007bff;
    color: #fff;
    padding: 10px 20px;
}

.section-title {
    background: #f0f0f0;
    font-weight: bold;
    padding: 6px 10px;
    margin-top: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

th,
td {
    padding: 4px 8px;
}

th {
    background: #f8f8f8;
}

.bordered th,
.bordered td {
    border: 1px solid #ccc;
}

.firma {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
    margin-top: 10px;
}

.firma img {
    max-width: 220px;
    max-height: 80px;
}

.row {
    display: flex;
}

.col {
    flex: 1;
    padding: 0 10px;
}

.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 24px;
}

.small {
    font-size: 11px;
    color: #666;
}

/* Specific table for Acciones Realizadas: keep th 30% and td 70% */
.actions-table th {
    text-align: right;
    width: 30%;
    max-width: 30%;
    vertical-align: top;
}

.actions-table td {
    width: 70%;
}

/* Carousel control styling: blue color and thicker arrows */
.service-images-modal .carousel-control-prev,
.service-images-modal .carousel-control-next {
    width: 4rem !important; /* clickable area */
    height: 100% !important;
    top: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
}

.service-images-modal .carousel-control-prev-icon,
.service-images-modal .carousel-control-next-icon {
    width: 2.2rem !important;
    height: 2.2rem !important;
    display: inline-block !important;
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23007bff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M11 3 L5 8 L11 13'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    opacity: 1 !important; /* fully visible */
    box-shadow: none !important;
    border-radius: 50% !important;
    background-color: transparent !important;
}

/* rotate the next icon to point right */
.service-images-modal .carousel-control-next-icon {
    transform: rotate(180deg) !important;
}

/* Ensure controls are above carousel content */
.service-images-modal .carousel-control-prev,
.service-images-modal .carousel-control-next {
    z-index: 1050 !important;
}

/* Constrain carousel images to viewport and keep aspect ratio */
.service-images-modal .modal-dialog {
    max-width: 90vw !important;
    margin: 1.5rem auto !important;
}

.service-images-modal .modal-content {
    background: #000 !important; /* dark background for images */
}

.service-images-modal .carousel,
.service-images-modal .carousel-inner {
    max-height: calc(100vh - 180px) !important; /* leave space for header/footer */
}

.service-images-modal .carousel-item {
    text-align: center;
    /* Allow Bootstrap to control visibility (do not force display:flex) */
    height: auto !important;
}

.service-images-modal .carousel-item img {
    max-height: calc(100vh - 220px) !important;
    max-width: calc(100vw - 120px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Estilos para impresión */
@media print {
    .print-table-styles th {
        width: 30%;
        text-align: right;
        vertical-align: top;
        padding-right: 15px;
        font-weight: bold;
    }

    .print-table-styles td {
        width: 70%;
    }

    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .card {
        border: none;
        box-shadow: none;
    }

    .card-header {
        background-color: #f8f9fa !important;
        border-bottom: 2px solid #dee2e6;
        font-weight: bold;
        padding: 10px;
        margin-bottom: 10px;
    }
}

/* Firmas - Canvas */
.signature-canvas {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: crosshair;
}

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

.signature-container canvas {
    display: block;
}

/* Miniaturas de imágenes */
.image-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.image-thumbnail {
    position: relative;
    width: 100px;
    height: 100px;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.image-thumbnail:hover {
    transform: scale(1.05);
}

.image-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    z-index: 10;
}

.image-delete-btn:hover {
    background: rgba(200, 35, 51, 1);
}

/* Campos dinámicos del sistema */
.dynamic-field-group {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.dynamic-field-group:last-child {
    border-bottom: none;
}

.dynamic-field-label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
}

.dynamic-field-input {
    width: 100%;
}

/* Alertas y mensajes */
.alert-services {
    border-left: 4px solid;
}

.alert-services.alert-success {
    border-left-color: #28a745;
}

.alert-services.alert-danger {
    border-left-color: #dc3545;
}

.alert-services.alert-warning {
    border-left-color: #ffc107;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .actions-table th,
    .print-table-styles th {
        width: 40%;
        font-size: 0.9em;
    }

    .actions-table td,
    .print-table-styles td {
        width: 60%;
        font-size: 0.9em;
    }

    .signature-canvas {
        max-width: 100%;
    }

    .service-images-modal .carousel-item img {
        max-height: 50vh !important;
    }
}
