/* templates.css */

/* Select Styles */
.template-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
}

.template-select:focus {
    border-color: #146c94 !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(20, 108, 148, 0.2) !important;
}

.template-select::-ms-expand {
    display: none;
}

/* Table Styles */
.template-table {
    border-collapse: separate;
    border-spacing: 0;
}

.template-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.template-table tbody tr {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.template-table tbody tr:hover {
    background: linear-gradient(to left, #eff6ff, #ede9fe) !important;
    box-shadow: 0 2px 8px rgba(20, 108, 148, 0.1);
    transform: none !important; /* Remove transform to prevent scroll */
}

/* Table Header Spacing */
.template-table thead tr:first-child th {
    padding-bottom: 1.25rem !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.template-table thead tr:last-child th {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

/* Sticky Header Fix */
.template-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
}

/* Prevent Layout Shift on Hover */
.template-table tbody tr:hover td {
    border-color: inherit;
}

/* Remove Transform from Hover */
.template-table tbody tr:hover {
    transform: translateX(0) !important;
}

/* Contract Title Dynamic */
#contract1Title,
#contract2Title {
    transition: all 0.3s ease;
}

/* Checkbox Styles */
.row-checkbox,
.select-all-contract {
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.row-checkbox:hover,
.select-all-contract:hover {
    transform: scale(1.1);
}

.row-checkbox:checked,
.select-all-contract:checked {
    background-color: #146c94;
    border-color: #146c94;
}

/* Row Selection */
.template-table tbody tr.selected {
    background: linear-gradient(to left, #dbeafe, #e0e7ff) !important;
    border-left: 4px solid #146c94;
}

/* Active Nav Indicator */
nav a[href="template"]::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #146c94, #19a7ce);
    border-radius: 3px 3px 0 0;
}

/* Category Cell */
.template-table tbody td[rowspan] {
    vertical-align: middle;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    font-weight: 700;
}

/* Alternating Background Colors */
.template-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

/* Blue Contract Column */
.bg-blue-50\/50 {
    background-color: rgba(239, 246, 255, 0.5);
}

/* Amber Contract Column */
.bg-amber-50\/50 {
    background-color: rgba(255, 251, 235, 0.5);
}

/* Selected Count Badge */
#selectedCount {
    min-width: 50px;
    text-align: center;
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Button Hover Effects */
#clearSelection:hover {
    background-color: #f3f4f6;
    border-color: #146c94;
    color: #146c94;
}

#exportExcel:hover,
#exportPDF:hover {
    transform: scale(1.05);
}

#exportExcel:active,
#exportPDF:active {
    transform: scale(0.98);
}

/* Loading State */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .template-table {
        font-size: 0.875rem;
    }

    .template-table th,
    .template-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .template-table {
        font-size: 0.75rem;
    }

    .template-table th,
    .template-table td {
        padding: 0.5rem 0.25rem;
    }

    .row-checkbox,
    .select-all-contract {
        width: 18px;
        height: 18px;
    }
}

/* Print Styles */
@media print {
    nav,
    footer,
    #processSelect,
    .action-buttons,
    .row-checkbox,
    .select-all-contract {
        display: none !important;
    }

    .template-table {
        border: 1px solid #000;
    }

    .template-table th,
    .template-table td {
        border: 1px solid #000;
    }
}

/* Scrollbar */
.overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: linear-gradient(to right, #146c94, #19a7ce);
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to right, #105578, #157ba3);
}

/* Accessibility */
.row-checkbox:focus,
.select-all-contract:focus {
    outline: 3px solid rgba(20, 108, 148, 0.5);
    outline-offset: 2px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.4s ease-out;
}

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}
