/* Custom styles for PrePlanning Data Interface */

html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Skip Navigation Link */
.skip-link {
    position: absolute;
    top: -40px;
    right: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 4px;
}

.skip-link:focus {
    top: 0;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    background-color: #4F008C !important;
}

.navbar.bg-primary {
    background-color: #4F008C !important;
}

.card {
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    border: none;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    padding: 1rem 1.25rem;
}

/* Table Styling */
.table {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.table thead th {
    background-color: #4F008C;
    color: white;
    font-weight: 600;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 1rem 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    transition: background-color 0.2s ease;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

/* Zebra striping */
.table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.table tbody tr:hover {
    background-color: #f3e8ff !important;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.table td {
    vertical-align: middle;
    word-wrap: break-word;
    max-width: 300px;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
}

/* Text truncation with tooltip */
.table td.text-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.table td.text-truncate:hover {
    background-color: #fff3cd;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .float-start {
    float: right !important;
}

[dir="rtl"] .float-end {
    float: left !important;
}

/* Statistics Cards */
#statistics-cards {
    display: flex;
    flex-wrap: wrap;
}

#statistics-cards .col-md-4 {
    display: flex;
}

#statistics-cards .card {
    transition: all 0.3s ease;
    border-radius: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#statistics-cards .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    padding: 1.5rem;
}

#statistics-cards .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(79, 0, 140, 0.2);
    border-top: 3px solid #4F008C;
}

#statistics-cards .card-title {
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

#statistics-cards .text-primary {
    color: #4F008C !important;
    font-size: 2rem;
    font-weight: 700;
}

/* Filters */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #4F008C;
    box-shadow: 0 0 0 0.2rem rgba(79, 0, 140, 0.25);
    outline: none;
}

/* Pagination */
.pagination {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0;
}

.page-link {
    color: #4F008C;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin: 0 2px;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.page-link:hover {
    background-color: #f3e8ff;
    border-color: #4F008C;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(79, 0, 140, 0.2);
}

.page-item.active .page-link {
    background-color: #4F008C;
    border-color: #4F008C;
    color: white;
    font-weight: 600;
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Badge */
.badge {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* Accessibility Improvements */
*:focus-visible {
    outline: 2px solid #4F008C;
    outline-offset: 2px;
    border-radius: 4px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid #4F008C;
    outline-offset: 2px;
}

/* Ensure sufficient color contrast */
.text-muted {
    color: #6c757d !important;
}

/* Keyboard navigation improvements */
.sortable[tabindex="0"]:focus {
    background-color: rgba(255, 255, 255, 0.3) !important;
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.filter-chip:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Modern UI Enhancements */
.card-body {
    padding: 1.5rem;
}

/* Prevent extra scroll at bottom */
#main-content {
    padding-bottom: 1rem;
}

.card:last-child {
    margin-bottom: 1rem;
}

.btn {
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
}

.btn:active {
    transform: translateY(0);
}

.badge {
    border-radius: 6px;
    font-weight: 500;
}

/* Loading Badge */
#loading-badge {
    animation: pulse 2s ease-in-out infinite;
}

/* Override Bootstrap primary color */
.bg-primary {
    background-color: #4F008C !important;
}

.text-primary {
    color: #4F008C !important;
}

.btn-primary {
    background-color: #4F008C;
    border-color: #4F008C;
}

.btn-primary:hover {
    background-color: #3d0069;
    border-color: #3d0069;
}

.btn-primary:focus {
    background-color: #4F008C;
    border-color: #4F008C;
    box-shadow: 0 0 0 0.2rem rgba(79, 0, 140, 0.25);
}

.badge.bg-primary {
    background-color: #4F008C !important;
}

.spinner-border.text-primary {
    color: #4F008C !important;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Smooth transitions for all interactive elements */
a, button, input, select, .sortable, .filter-chip {
    transition: all 0.2s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .table {
        font-size: 0.8rem;
    }
    
    .table td {
        max-width: 150px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .filter-chips-container {
        padding: 0.5rem;
    }
    
    .filter-chip {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .empty-state,
    .loading-state {
        padding: 2rem 1rem;
    }
}

/* Arabic text support */
.arabic-text {
    direction: rtl;
    text-align: right;
}

/* Export button */
.btn-success {
    transition: background-color 0.2s;
}

.btn-success:hover {
    background-color: #198754;
}

/* Sorting styles */
.sortable {
    position: relative;
    transition: background-color 0.2s ease;
    outline: none;
}

.sortable:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

.sortable:focus {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.sort-icon {
    font-size: 0.8em;
    margin-right: 5px;
    display: inline-block;
    transition: opacity 0.2s ease;
}

/* Filter Chips */
.filter-chips-container {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    min-height: 50px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.filter-chips-label {
    font-weight: 600;
    color: #495057;
    margin-left: 0.5rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip:hover {
    background-color: #3d0069 !important;
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(79, 0, 140, 0.3);
}

.filter-chip:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.filter-chip i {
    margin-right: 0.25rem;
    font-size: 0.875rem;
}

/* Record Count */
#record-count {
    margin-top: 0.5rem;
}

#record-count .badge {
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
    border-radius: 6px;
}

/* Empty and Loading States */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state i {
    display: block;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.loading-state {
    padding: 3rem 1rem;
    text-align: center;
}

.loading-state .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.loading-state p {
    margin-top: 1rem;
    font-size: 1rem;
    color: #6c757d;
}

/* Filter Panel Collapse Animation */
#filter-panel {
    transition: all 0.3s ease;
}

#filter-toggle-btn {
    text-decoration: none !important;
    color: inherit !important;
}

#filter-toggle-btn:hover {
    color: #4F008C !important;
}

#filter-toggle-icon {
    transition: transform 0.3s ease;
}
