/* Survey KHDTK Styles - VERSION 1757594550 - OVERFLOW FIX */

.survey-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Grid Selector Styles */
.grid-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    margin: 1rem 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.grid-item {
    aspect-ratio: 1;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
    background-color: white;
    position: relative;
}

.grid-item:hover {
    border-color: #28a745;
    background-color: #e8f5e8;
    transform: scale(1.05);
}

.grid-item.selected {
    border-color: #28a745;
    background-color: #28a745;
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.grid-item.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #155724;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Category Selector Styles */
.category-card {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background-color: white;
}

.category-card:hover {
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.category-card.selected {
    border-color: #28a745;
    background-color: #f8f9fa;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.category-card .category-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
}

.category-card .subcategories {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
}

/* Custom Category Styles */
.custom-category-item {
    border: 1px solid #dee2e6;
    animation: slideIn 0.3s ease;
}

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

/* Progress Styles */
.survey-progress {
    height: 24px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.survey-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 50%, #17a2b8 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    position: relative;
}

.survey-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 0.875rem;
    color: #495057;
    z-index: 1;
}

/* Status Badge Styles */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.status-draft {
    background-color: #6c757d;
    color: white;
}

.status-badge.status-active {
    background-color: #28a745;
    color: white;
}

.status-badge.status-completed {
    background-color: #007bff;
    color: white;
}

.status-badge.status-approved {
    background-color: #17a2b8;
    color: white;
}

/* Form Styles */
.survey-form {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.survey-form .form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.survey-form .form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.survey-form .section-title {
    color: #28a745;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.survey-form .section-title i {
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

/* Controls Styles */
.survey-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.survey-controls .btn {
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .grid-selector {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 6px;
        padding: 0.75rem;
    }
    
    .grid-item {
        font-size: 0.8rem;
    }
    
    .category-card {
        padding: 0.75rem;
    }
    
    .survey-form {
        padding: 1.5rem;
    }
    
    .survey-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .survey-controls .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 576px) {
    .grid-selector {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: 4px;
    }
    
    .category-card {
        padding: 0.5rem;
    }
    
    .survey-form {
        padding: 1rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(40, 167, 69, 0.3);
    border-radius: 50%;
    border-top-color: #28a745;
    animation: spin 1s ease-in-out infinite;
}

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

/* Biodiversity Table Dropdown Styles - ULTIMATE FIX */

/* Force all dropdowns in biodiversity tables to appear above everything */
#biodiversity-tables .dropdown-menu,
#biodiversity-tables .dropdown-menu.show,
.biodiversity-dropdown-menu {
    position: fixed !important;
    z-index: 999999 !important;
    background-color: white !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    min-width: 160px !important;
    padding: 0.5rem 0 !important;
    margin: 0 !important;
    font-size: 0.875rem !important;
    text-align: left !important;
    list-style: none !important;
}

/* Dropdown items styling */
#biodiversity-tables .dropdown-item,
.biodiversity-dropdown-menu .dropdown-item {
    display: block !important;
    width: 100% !important;
    padding: 0.375rem 1rem !important;
    clear: both !important;
    font-weight: 400 !important;
    color: #212529 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    background-color: transparent !important;
    border: 0 !important;
    cursor: pointer !important;
}

#biodiversity-tables .dropdown-item:hover,
#biodiversity-tables .dropdown-item:focus,
.biodiversity-dropdown-menu .dropdown-item:hover {
    background-color: #e9ecef !important;
    color: #16181b !important;
}

#biodiversity-tables .dropdown-item.text-danger:hover {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

#biodiversity-tables .dropdown-divider,
.biodiversity-dropdown-menu .dropdown-divider {
    height: 0 !important;
    margin: 0.5rem 0 !important;
    overflow: hidden !important;
    border-top: 1px solid #dee2e6 !important;
}

/* Table container spacing - CRITICAL FOR DROPDOWN SPACE */
#biodiversity-tables .card {
    margin-bottom: 200px !important; /* Much larger space between tables */
    position: relative !important;
}

/* Table body minimum height */
#biodiversity-tables tbody {
    min-height: 200px !important; /* Ensure adequate space */
    position: relative !important;
}

/* Empty row padding for extra space */
#biodiversity-tables .empty-row td {
    padding: 60px 20px !important;
}

/* Spacing rows for dropdown space */
#biodiversity-tables .spacing-row {
    height: 50px !important;
    line-height: 50px !important;
}

#biodiversity-tables .spacing-row td {
    height: 50px !important;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}

/* Dropdown toggle button */
#biodiversity-tables .dropdown-toggle {
    position: relative !important;
    z-index: 100 !important;
}

/* CRITICAL: Remove all overflow constraints from table containers */
.table-responsive,
#biodiversity-tables .table-responsive,
#biodiversity-tables .card-body,
#biodiversity-tables .card,
#biodiversity-tables {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Force table containers to not create scroll areas */
#biodiversity-tables .table-responsive {
    max-height: none !important;
    height: auto !important;
}

/* Ensure no parent containers create stacking contexts that interfere */
#biodiversity-tables,
#biodiversity-tables .card,
#biodiversity-tables .card-body {
    position: static !important;
    transform: none !important;
    contain: none !important;
}

/* Force visibility of dropdowns */
body #biodiversity-tables .dropdown-menu.show,
body #biodiversity-tables .show > .dropdown-menu,
.biodiversity-dropdown-menu {
    position: fixed !important;
    z-index: 999999 !important;
    display: block !important;
    will-change: auto !important;
    transform: none !important;
    contain: none !important;
}

/* Print Styles */
@media print {
    .survey-controls,
    .btn,
    .survey-header {
        display: none !important;
    }
    
    .survey-form {
        box-shadow: none;
        padding: 0;
    }
    
    .grid-selector {
        border: 1px solid #000;
        background-color: transparent;
    }
    
    .grid-item {
        border-color: #000;
        background-color: transparent;
    }
    
    .grid-item.selected {
        background-color: #000;
        color: white;
    }
}