/* Modern UI Theme */
:root {
    --primary: #2f855a;   /* Emerald Green */
    --secondary: #4fd1c5; /* Teal Accent */
    --success: #38a169;
    --warning: #ecc94b;
    --danger: #e53e3e;
    --background: #f7fafc;
    
    
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --transition: all 0.2s ease-in-out;
}

/* Base styles */
body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    background-color: #f5f7fa;
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation styles */
.modern-header {
    background: linear-gradient(135deg, var(--primary) 0%, #1a5d3a 100%) !important;
    padding: 0.5rem 1rem; /* Reduced from 0.3rem 1rem */
    box-shadow: 0 2px 20px rgba(47, 133, 90, 0.3) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: 60px; /* Fixed height for consistency */
}

.brand-icon {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
    overflow: hidden;
}

.brand-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transition: left 0.5s;
}

.brand-icon:hover::before {
    left: 100%;
}

.brand-icon:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.2),
        0 4px 10px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.brand-icon i {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 600;
    z-index: 1;
    position: relative;
}

.brand-icon-large {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.brand-icon-large:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.navbar-brand span {
    font-size: 1.3rem;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.navbar-brand:hover .brand-icon {
    transform: rotate(5deg) scale(1.1);
}

.modern-nav {
    border-bottom: none !important;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08) !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    position: fixed;
    top: 60px; /* Match header height */
    left: 0;
    right: 0;
    z-index: 1020;
    height: 65px; /* Fixed height */
}

.nav-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.nav-scroll-btn {
    background: rgba(47, 133, 90, 0.1);
    border: 1px solid rgba(47, 133, 90, 0.2);
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 10px;
    flex-shrink: 0;
}

.nav-scroll-btn:hover {
    background: rgba(47, 133, 90, 0.2);
    transform: scale(1.1);
}

.nav-scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-scroll-btn i {
    font-size: 1.2rem;
}

.horizontal-nav {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 1rem;
    /* Show scrollbars for better UX */
    scrollbar-width: thin;
    scrollbar-color: rgba(47, 133, 90, 0.3) transparent;
    scroll-behavior: smooth;
    position: relative;
    /* Ensure proper scrolling */
    min-width: 0;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.horizontal-nav::-webkit-scrollbar {
    display: none;
}

/* Custom scrollbar for webkit browsers */
.horizontal-nav::-webkit-scrollbar {
    height: 4px;
}

.horizontal-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.horizontal-nav::-webkit-scrollbar-thumb {
    background: rgba(47, 133, 90, 0.3);
    border-radius: 2px;
}

.horizontal-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(47, 133, 90, 0.5);
}

/* Add scroll indicators with better visibility */
.horizontal-nav::before,
.horizontal-nav::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 4px; /* Account for scrollbar */
    width: 30px;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.horizontal-nav::before {
    left: 0;
    background: linear-gradient(90deg, rgba(248, 250, 252, 0.95) 0%, rgba(248, 250, 252, 0) 100%);
}

.horizontal-nav::after {
    right: 0;
    background: linear-gradient(270deg, rgba(248, 250, 252, 0.95) 0%, rgba(248, 250, 252, 0) 100%);
}

.horizontal-nav .nav-item {
    white-space: nowrap;
    margin-right: 4px;
    flex-shrink: 0;
    /* Ensure items don't compress */
    min-width: fit-content;
}

.horizontal-nav .nav-link {
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 1rem 1.2rem;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    position: relative;
    background: transparent;
    text-decoration: none;
    /* Ensure proper sizing */
    min-width: fit-content;
    white-space: nowrap;
}

.nav-icon {
    margin-right: 0.5rem;
    font-size: 1rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.horizontal-nav .nav-link:hover {
    color: var(--primary);
    background: linear-gradient(135deg, rgba(47, 133, 90, 0.08) 0%, rgba(47, 133, 90, 0.04) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 133, 90, 0.15);
}

.horizontal-nav .nav-link:hover .nav-icon {
    opacity: 1;
    transform: scale(1.1);
}

.horizontal-nav .nav-link.active {
    color: var(--primary);
    background: linear-gradient(135deg, rgba(47, 133, 90, 0.1) 0%, rgba(47, 133, 90, 0.05) 100%);
    border-bottom: 3px solid var(--primary);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(47, 133, 90, 0.2);
}

.horizontal-nav .nav-link.active .nav-icon {
    opacity: 1;
    color: var(--primary);
}

.horizontal-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, var(--primary) 0%, var(--primary) 70%, transparent 70%);
    border-radius: 40%;
  
}

@keyframes pulse-dot {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(1.2); opacity: 0.8; }
}

/* Spacer to prevent content from being hidden under fixed navbars */
.fixed-nav-spacer {
    height: 125px; /* Combined height of header (60px) and nav (65px) */
}

/* Content area */
.content-wrapper {
    padding: 1.5rem;
    flex: 1;
}

/* Cards and tables */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.table {
    margin-bottom: 0;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

.table-hover tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

/* Form elements */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border-color: var(--gray-300);
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

.btn {
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

/* Loading indicator */
#loadingIndicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

.spinner-border {
    color: var(--primary);
}

/* Chart container */
.chart-container {
    position: relative;
    margin: auto;
    height: 300px;
    width: 100%;
}

canvas {
    max-width: 100%;
}

/* Stats cards */
.stats-card {
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stats-card .icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.stats-card .title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.stats-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0;
}

.stats-card .trend {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.stats-card .trend-up {
    color: var(--success);
}

.stats-card .trend-down {
    color: var(--danger);
}

/* Footer */
.footer {
    background-color: #fff;
    padding: 1rem 0;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .modern-header {
        height: 56px; /* Reduced height for mobile */
    }
    
    .modern-nav {
        top: 56px; /* Match mobile header height */
        height: 60px; /* Slightly reduced for mobile */
    }
    
    .fixed-nav-spacer {
        height: 116px; /* Combined height for mobile */
    }
    
    /* Make horizontal nav more touch-friendly on mobile */
    .horizontal-nav {
        padding: 0 0.5rem;
        /* Show scrollbar on mobile for better UX */
        scrollbar-width: auto;
    }
    
    .horizontal-nav::-webkit-scrollbar {
        height: 6px; /* Slightly thicker on mobile */
    }
    
    .horizontal-nav .nav-item {
        flex-shrink: 0;
        white-space: nowrap;
        margin-right: 2px;
    }
    
    .horizontal-nav .nav-link {
        padding: 0.8rem 1rem;
        font-size: 0.8rem;
        min-width: fit-content;
    }
    
    /* Remove gradient indicators on mobile to avoid confusion */
    .horizontal-nav::before,
    .horizontal-nav::after {
        display: none;
    }
    
    /* Style for mobile navigation when collapsed */
    #navbarContent .horizontal-nav {
        flex-direction: column;
        margin-top: 1rem;
        padding: 0;
        overflow-x: visible;
        overflow-y: auto;
        max-height: 60vh;
    }
    
    #navbarContent .horizontal-nav .nav-item {
        width: 100%;
        margin-right: 0;
        margin-bottom: 2px;
    }
    
    #navbarContent .horizontal-nav .nav-link {
        padding: 0.75rem 1rem;
        color: white;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        margin-bottom: 2px;
    }
    
    #navbarContent .horizontal-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: white;
    }
    
    #navbarContent .horizontal-nav .nav-link.active {
        background-color: rgba(255, 255, 255, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
        color: white;
    }
    
    /* Ensure the collapsed menu appears properly */
    .navbar-collapse.show {
        max-height: 80vh;
        overflow-y: auto;
    }
}

@media (max-width: 767.98px) {
    .brand-icon {
        width: 32px;
        height: 32px;
        padding: 8px;
    }
    
    .brand-icon i {
        font-size: 1.1rem;
    }
    
    .navbar-brand span {
        font-size: 1.1rem;
    }
    
    .horizontal-nav .nav-link {
        padding: 0.7rem 0.9rem;
        font-size: 0.8rem;
    }
    
    .nav-icon {
        margin-right: 0.4rem;
        font-size: 0.9rem;
    }
}

/* Enhanced table styles */
.table-hover tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Stat cards */
.stats-card {
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Enhanced card styles */
.card {
    transition: all 0.2s ease-in-out;
}

.card-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header h5 {
    margin-bottom: 0;
    font-weight: 600;
}

/* Table cell highlighting */
.table td.text-danger {
    background-color: rgba(230, 57, 70, 0.05);
}

/* Chart container enhancements */
#graphContainer {
    background-color: #fff;
}

#graphContainer .card-body {
    padding: 1rem;
}

/* Filter form enhancements */
#filterForm .input-group-text {
    background-color: #f8f9fa;
}

#filterForm .form-control:focus,
#filterForm .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

/* Print styles */
@media print {
    .navbar, .footer, .btn, .form-check, .dropdown {
        display: none !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    .card-header, .card-footer {
        background-color: transparent !important;
    }
    
    .table {
        width: 100% !important;
    }
    
    .table th {
        background-color: #f5f5f5 !important;
        color: #000 !important;
    }
}

/* Responsive adjustments for the TILL page */
@media (max-width: 992px) {
    #statCards .card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        max-height: 500px;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .card-header .btn-group,
    .card-header .form-check {
        margin-top: 0.5rem;
    }
    
    #filterForm .col-md-3 {
        margin-bottom: 1rem;
    }
}

/* Animation for loading indicator */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#loadingIndicator .spinner-border {
    animation: pulse 1.5s infinite ease-in-out;
}

/* Tooltip styling */
.tooltip-inner {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 8px 12px;
    border-radius: 4px;
}

/* Button hover effects */
.btn-primary:hover {
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

.btn-outline-secondary:hover {
    background-color: #f8f9fa;
    color: var(--primary);
    border-color: var(--primary);
}

/* Table column highlighting */
.table th.bg-light, .table td.bg-light {
    background-color: rgba(248, 249, 250, 0.5) !important;
}

/* Improved scrollbar for table */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Add responsive styles for the username and logout button */
@media (max-width: 576px) {
    .navbar-nav .nav-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .navbar-nav .btn-sm {
        margin-top: 5px;
        margin-left: 25px; /* Align with the username text */
    }
}

/* Add these styles to fix the hamburger menu */
.navbar-toggler {
    z-index: 1040; /* Higher than other elements */
    position: relative; /* Ensure it's positioned properly */
    border: none;
    padding: 0.5rem;
}

.navbar-toggler:focus {
    outline: none;
    box-shadow: none;
}

/* Ensure the collapsed menu appears above other content */
.navbar-collapse.show {
    display: block !important;
    z-index: 1035;
    background-color: var(--primary); /* Match your header background */
    padding: 15px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
}

/* Ensure the navbar-collapse has proper styling */
.navbar-collapse {
    transition: all 0.3s ease;
}

/* Add smooth scrolling for navigation */
.horizontal-nav {
    scroll-padding-left: 20px;
    scroll-padding-right: 20px;
}

/* Add scroll hint for better UX */
.modern-nav::after {
    content: '← Scroll →';
    position: absolute;
    bottom: 2px;
    right: 10px;
    font-size: 0.7rem;
    color: var(--gray-400);
    pointer-events: none;
    opacity: 0.7;
    font-style: italic;
}

@media (max-width: 991.98px) {
    .nav-scroll-btn {
        display: none !important;
    }
    
    .horizontal-nav {
        /* Show scrollbar on mobile */
        scrollbar-width: thin;
        scrollbar-color: rgba(47, 133, 90, 0.3) transparent;
    }
    
    .horizontal-nav::-webkit-scrollbar {
        display: block;
        height: 4px;
    }
    
    .horizontal-nav::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 2px;
    }
    
    .horizontal-nav::-webkit-scrollbar-thumb {
        background: rgba(47, 133, 90, 0.3);
        border-radius: 2px;
    }
    
    .modern-nav::after {
        content: '← Swipe →';
        font-size: 0.65rem;
    }
}

@media (max-width: 767.98px) {
    .modern-nav::after {
        display: none; /* Hide on very small screens */
    }
}
