/* CATEM Morelos Custom Styles */

:root {
    --catem-red: #FF0000;
    --catem-black: #000000;
    --catem-white: #FFFFFF;
    --catem-light-gray: #F8F9FA;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--catem-light-gray) 0%, #E9ECEF 100%);
    color: var(--catem-black);
}

/* Custom red styling for Bootstrap components */
.btn-danger {
    background-color: var(--catem-red);
    border-color: var(--catem-red);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: #cc0000;
    border-color: #cc0000;
    transform: translateY(-1px);
}

.btn-danger:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 0, 0, 0.25);
}

.bg-danger {
    background-color: var(--catem-red) !important;
}

.border-danger {
    border-color: var(--catem-red) !important;
    border-width: 2px !important;
}

.text-danger {
    color: var(--catem-red) !important;
}

/* Card styling */
.card {
    border-radius: 15px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.card-header {
    border-bottom: none;
}

.card-footer {
    border-top: 1px solid #dee2e6;
}

/* Form styling */
.form-control {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 16px;
    padding: 12px 16px;
}

.form-control:focus {
    border-color: var(--catem-red);
    box-shadow: 0 0 0 0.2rem rgba(255, 0, 0, 0.1);
}

.input-group-text {
    border: 2px solid #dee2e6;
    border-right: none;
    background-color: var(--catem-light-gray);
    color: #6c757d;
}

.input-group .form-control {
    border-left: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--catem-red);
}

/* Labels */
.form-label {
    color: var(--catem-black);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Alert styling */
.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    border-color: #198754;
    color: #0f5132;
}

.alert-danger {
    background-color: rgba(255, 0, 0, 0.1);
    border-color: var(--catem-red);
    color: #842029;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading state */
.btn:disabled {
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .container-fluid {
        padding: 15px;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Custom focus styles for accessibility */
.btn:focus,
.form-control:focus,
button:focus {
    outline: 2px solid var(--catem-red);
    outline-offset: 2px;
}

/* Icon styling */
.fa-lock,
.fa-user,
.fa-eye,
.fa-eye-slash {
    color: #6c757d;
}

.card-header .fa-lock {
    color: var(--catem-white);
}

/* Auto CSV Loader specific styles */
.afiliaciones-table {
    font-size: 0.85rem;
    line-height: 1.3;
}

.afiliaciones-table th {
    font-size: 0.8rem;
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom: 2px solid #FF0000;
    padding: 8px 6px;
    white-space: nowrap;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.afiliaciones-table td {
    padding: 6px 4px;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.afiliaciones-table .phone-col {
    min-width: 120px;
}

.afiliaciones-table .name-col {
    min-width: 150px;
    text-align: left;
}

.afiliaciones-table .address-col {
    min-width: 120px;
    text-align: left;
}

.afiliaciones-table .actions-col,
.afiliaciones-table th:last-child,
.afiliaciones-table td:last-child {
    min-width: 80px !important;
    position: sticky !important;
    right: 0 !important;
    background-color: white !important;
    border-left: 1px solid #dee2e6 !important;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1) !important;
    z-index: 9 !important;
}

/* Enhanced scroll styles for better mobile and desktop experience */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #FF0000;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #cc0000;
}

/* Search input styling */
#globalSearchInput {
    border-radius: 0.375rem 0 0 0.375rem;
}

#clearSearchBtn {
    border-radius: 0 0.375rem 0.375rem 0;
    border-left: none;
}

.input-group .input-group-text {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* Improved table layout for better horizontal scrolling */
.afiliaciones-table {
    min-width: 1800px; /* Ensure table has minimum width for all columns */
    table-layout: auto;
}

.afiliaciones-table th,
.afiliaciones-table td {
    white-space: nowrap;
    padding: 8px 12px;
}

/* Sticky first column for better navigation */
.afiliaciones-table th:first-child,
.afiliaciones-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    background-color: white !important;
    z-index: 10 !important;
    border-right: 1px solid #dee2e6 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important;
    min-width: 50px !important;
}

.afiliaciones-table th:first-child {
    background-color: #FF0000 !important;
    color: white !important;
    z-index: 11 !important;
}

/* Filter highlights */
.search-highlight {
    background-color: #fff3cd;
    font-weight: bold;
}

/* Responsive search controls */
@media (max-width: 768px) {
    .card-header .row {
        gap: 1rem;
    }
    
    .col-md-8, .col-md-4 {
        flex: 1;
    }
    
    #globalSearchInput {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Table responsive configuration already defined above */

.card-header .btn {
    margin-left: 0.5rem;
}

.card-title .badge {
    margin-left: 0.5rem;
}

/* Modal styles */
.modal-dialog-lg {
    max-width: 900px;
}

.modal-header {
    background: linear-gradient(135deg, #FF0000 0%, #cc0000 100%);
    color: white;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-navigation {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.record-position {
    font-weight: 600;
    color: #495057;
}

.nav-pills .nav-link {
    color: #495057;
    border-radius: 0.5rem;
    margin-right: 0.25rem;
}

.nav-pills .nav-link.active {
    background-color: #FF0000;
    color: white;
}

.nav-pills .nav-link:hover:not(.active) {
    background-color: #f8f9fa;
    color: #FF0000;
}

.modal-section {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.modal-section h6 {
    color: #FF0000;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.form-control:disabled {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.img-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    min-height: 200px;
    transition: all 0.3s ease;
}

.img-placeholder:hover {
    border-color: #FF0000;
    color: #FF0000;
}

.img-placeholder i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

.photos-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .modal-dialog-lg {
        max-width: 95%;
        margin: 1rem;
    }
    
    .photos-container {
        grid-template-columns: 1fr;
    }
    
    .modal-navigation {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .afiliaciones-table .actions-col {
        position: static;
        box-shadow: none;
    }
}