/* FlexoWatch v1.5.0 Custom Styles */

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --hover-color: #e9ecef;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Status badges */
.status-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.25rem;
}

.status-active {
    background-color: var(--success-color) !important;
    color: white;
}

.status-inactive {
    background-color: var(--warning-color) !important;
    color: white;
}

.status-offline {
    background-color: var(--danger-color) !important;
    color: white;
}

/* Table styles */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem 0.75rem;
}

.table td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.user-row {
    transition: background-color 0.15s ease-in-out;
}

/* Action buttons */
.action-btn {
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.action-btn:hover {
    transform: translateY(-1px);
    transition: transform 0.15s ease-in-out;
}

/* Stats cards */
.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%) !important;
}

.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%) !important;
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Connection status */
.connection-status .badge {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

/* Form controls */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

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

/* Modals */
.modal-header {
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
}

/* Responsive design */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn-sm {
        padding: 0.125rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

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

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

/* Custom scrollbar */
.table-responsive::-webkit-scrollbar {
    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;
}

/* Utility classes */
.text-truncate-custom {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shadow-custom {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Dark mode support (for future enhancement) */
@media (prefers-color-scheme: dark) {
    .table {
        --bs-table-bg: transparent;
    }
}

/* Print styles */
@media print {
    .navbar,
    .action-btn,
    .btn {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .table th,
    .table td {
        color: #000 !important;
    }
}
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Override Bootstrap primary color with Flexothene blue */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-primary:hover {
    background-color: #1e40af !important;
    border-color: #1e40af !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Flexothene brand logo in navbar */
.navbar-brand img {
    border-radius: 50%;
    background: white;
    padding: 2px;
}

/* Footer styling - Full width branded footer with Flexothene gradient */
.flexothene-footer {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6, #60a5fa);
    border-top: none;
    padding: 2rem 0;
    margin-top: auto;
    min-height: 120px;
    display: flex;
    align-items: center;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    width: 100%;
}

.copyright-text-centered {
    color: #000000;
    background: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 1.3rem;
    line-height: 1.5;
    font-weight: 500;
    width: 100%;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.copyright-text-centered strong {
    font-weight: 700;
}
    justify-content: space-between;
    max-width: 100%;
    padding: 0 2rem;
    color: white;
}/* Old footer styles removed - using new centered layout */

.footer-right strong {
    color: white;
    font-weight: 600;
}

/* Stats cards with Flexothene colors */
.card-stats-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.card-stats-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
}

.card-stats-accent {
    background: linear-gradient(135deg, var(--accent-color), #93c5fd);
    color: white;
}

/* Dark theme overrides for main app */
.dark-theme .navbar {
    background-color: var(--primary-color) !important;
}

.dark-theme .card {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.dark-theme .table {
    color: var(--text-primary);
}

.dark-theme .table-dark {
    background-color: var(--bg-secondary);
}

/* Sortable Table Columns - Border Animation Instead of Background */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.sortable:hover {
    border-color: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

.sort-icon {
    margin-left: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    font-size: 0.75rem;
}

.sortable:hover .sort-icon {
    opacity: 1;
}

.sortable.sort-asc .sort-icon:before {
    content: "\f0de"; /* fa-sort-up */
    opacity: 1;
}

.sortable.sort-desc .sort-icon:before {
    content: "\f0dd"; /* fa-sort-down */
    opacity: 1;
}

/* Search highlighting */
.search-highlight {
    background-color: yellow;
    color: black;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    font-weight: bold;
}

/* Role-based dashboard visibility */
.admin-only {
    display: block;
}

.user-role .admin-only {
    display: none !important;
}

/* Enhanced table responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .sortable {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .sort-icon {
        display: none;
    }
}

/* Search instruction overlay */
.search-instruction {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    z-index: 1050;
    display: none;
    text-align: center;
}

.search-instruction.show {
    display: block;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
     20%, 80% { opacity: 1; }
}

/* Responsive footer design */
@media (max-width: 768px) {
    .flexothene-footer {
        padding: 1.5rem 0;
        min-height: 100px;
    }
    
    .footer-content {
        padding: 0 1rem;
    }
    
    .copyright-text-centered {
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
    }
}

/* Enhanced table header spacing for touch devices */
@media (max-width: 768px) {
    .sortable {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .sort-icon {
        font-size: 0.7rem;
    }
}

/* Header branding styling */
.header-branding {
    height: 40px;
    width: auto;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .header-branding {
        height: 30px;
    }
}

/* Fix dropdown menu positioning to stay within viewport */
.navbar-nav .dropdown-menu {
    right: 0;
    left: auto;
    transform: translateX(0);
    min-width: 200px;
    margin-top: 0.5rem;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Ensure dropdown doesn't overflow right edge */
@media (max-width: 768px) {
    .navbar-nav .dropdown-menu {
        position: absolute;
        right: 0;
        left: auto;
        transform: none;
        width: 250px;
        max-width: calc(100vw - 2rem);
    }
}

/* Adjust dropdown on very small screens */
@media (max-width: 480px) {
    .navbar-nav .dropdown-menu {
        width: 200px;
        font-size: 0.9rem;
    }
}

/* Fix dropdown menu positioning to stay within viewport */
.navbar-nav .dropdown-menu {
    right: 0;
    left: auto;
    transform: translateX(0);
    min-width: 200px;
    margin-top: 0.5rem;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Header branding styling */
.header-branding {
    height: 40px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .header-branding {
        height: 30px;
    }
}

/* Fix dropdown menu positioning to stay within viewport */
.dropdown-menu {
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin-top: 0.125rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

/* Ensure dropdown doesn't go outside viewport */
.navbar-nav .dropdown {
    position: static;
}

.navbar-nav .dropdown .dropdown-menu {
    position: absolute;
    right: 0;
    left: auto;
    top: 100%;
    min-width: 200px;
    z-index: 1050;
}

/* For smaller screens, ensure menu fits */
@media (max-width: 768px) {
    .dropdown-menu {
        right: 1rem !important;
        min-width: 180px;
    }
}

/* Clickable cards hover effect */
.clickable-card {
    transition: all 0.3s ease;
}

.clickable-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Offline Users Modal Styling */
#offlineUsersModal .modal-dialog {
    max-width: 1200px;
}

#offlineUsersModal .table th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

#offlineUsersModal .table td {
    vertical-align: middle;
    border-color: rgba(0, 0, 0, 0.1);
}

#offlineUsersModal .table tbody tr:hover {
    background-color: rgba(30, 58, 138, 0.05);
}

/* Modal header styling */
#offlineUsersModal .modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom: none;
}

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

#offlineUsersModal .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}


/* ============================================
   FIXED LAYOUT WITH STICKY FOOTER AND HEADER
   ============================================ */

/* Make body a flex container with fixed height */
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    overflow: hidden; /* Prevent body scroll */
}

/* Navbar fixed at top - always visible */
.navbar {
    flex-shrink: 0;
    z-index: 1030;
}

/* Main content area - flex container */
.main-scroll-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Important for Firefox */
}

/* Container for header sections (logo, stats) - NO scrolling, ALWAYS VISIBLE */
.content-header-fixed {
    flex-shrink: 0;
    overflow: visible;
}

/* Table container - THIS is the ONLY scrollable area */
.table-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0; /* Important for Firefox */
}

/* Footer fixed at bottom - always visible */
.flexothene-footer {
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
    padding: 1rem 0;
    z-index: 1020;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Table container */
.table-container-fixed {
    position: relative;
}

/* Sticky table header */
.table-fixed-header thead th {
    position: sticky;
    top: 0;
    background-color: #212529 !important;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Row numbering column */
.row-number-col {
    width: 50px;
    text-align: center;
    font-weight: 600;
    color: #6c757d;
    background-color: #f8f9fa;
    border-right: 2px solid #dee2e6;
    vertical-align: middle;
    font-size: 0.9rem;
}

.row-number-col-header {
    width: 50px;
    text-align: center;
    background-color: #212529 !important;
    border-right: 2px solid #495057;
    position: sticky;
    top: 0;
    z-index: 11;
}

/* Alternating row colors for better readability */
.table tbody tr:nth-child(even) .row-number-col {
    background-color: #e9ecef;
}

/* Highlight row number on hover */
.table tbody tr:hover .row-number-col {
    background-color: #d1d5db;
    color: #1e3a8a;
}

/* Ensure table is full width */
.table {
    margin-bottom: 0;
}

/* Scrollbar styling for table area ONLY */
.table-scroll-area::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.table-scroll-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.table-scroll-area::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

.table-scroll-area::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Adjust card body padding for table */
.card-body.p-0 {
    padding: 0 !important;
}

/* Footer content centering */
.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.copyright-text-centered {
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .row-number-col,
    .row-number-col-header {
        width: 40px;
        font-size: 0.8rem;
    }
    
    .flexothene-footer {
        padding: 0.5rem 0;
        font-size: 0.75rem;
    }
}

/* Print styles - hide row numbers in print */
@media print {
    .row-number-col,
    .row-number-col-header {
        display: none;
    }
}
