/* Dashboard Premium Overview - New Layout System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --dark-bg: #030712;
    --card-bg: rgba(17, 24, 39, 0.6);
    --sidebar-bg: rgba(17, 24, 39, 0.7);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Ambient Background */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(3, 7, 18, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.3);
}

/* Firefox Support */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) rgba(3, 7, 18, 0.2);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

/* Layout Shell */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 12px;
    margin-bottom: 4px;
    gap: 12px;
    position: relative; /* For badge positioning */
}

.nav-badge {
    background: #ef4444; /* Danger Red */
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
    margin-left: auto; /* Push to the right */
}

.nav-item:hover,
.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: var(--glass-border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    /* Sidebar width */
    padding: 30px;
    position: relative;
    z-index: 10;
}

/* Header (Top Bar) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 16px;
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-icon {
    float: right;
    font-size: 1.5rem;
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 12px;
    color: var(--primary);
}

/* Map Section */
.map-section {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
}

/* Table Section */
.table-container {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.table-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 16px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    border-bottom: var(--glass-border);
}

td {
    padding: 16px;
    border-bottom: var(--glass-border);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

/* Fix Table Width and Text overflow */
table {
    table-layout: auto;
    width: 100%;
}

td,
th {
    white-space: nowrap;
}

td:first-child {
    white-space: normal;
    word-break: break-all;
    max-width: 200px;
    /* Limit name width */
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
}

.status-completed,
.status-paid {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-process {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-failed,
.status-canceled {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-right: 4px;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    gap: 8px;
    list-style: none;
    padding: 0;
}

.pagination a {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.pagination .active a {
    background: var(--primary);
    color: white;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }
}

/* Form Styles for Premium Theme */
.form-group {
    margin-bottom: 20px;
}

.control-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Primary Button */
.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* DataTables Overrides for Premium Theme */
.dataTables_wrapper {
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    padding: 10px 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-muted) !important;
}

/* Inputs and Selects */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: rgba(0, 0, 0, 0.2);
    border: var(--glass-border);
    color: var(--text-main);
    border-radius: 8px;
    padding: 6px 12px;
    outline: none;
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 10px;
}

/* Wrapper background reset */
table.dataTable tbody tr {
    background-color: transparent !important;
}

table.dataTable tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

table.dataTable.no-footer {
    border-bottom: var(--glass-border) !important;
}

/* Pagination Buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-main) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    margin: 0 4px !important;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary) !important;
    color: white !important;
    background-color: var(--primary) !important;
    /* Force override */
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    background-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
    background: transparent !important;
    color: var(--text-muted) !important;
    cursor: default;
    box-shadow: none;
}

/* Custom Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.switch input:checked+.slider {
    background: var(--gradient);
    border-color: transparent;
}

.switch input:checked+.slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Premium Modal System */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.5);
    /* Much lighter overlay for contrast */
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content-premium {
    background: #111827;
    /* Dark but slightly lighter than pure black */
    border: 1px solid rgba(255, 255, 255, 0.15);
    /* Stronger border for visibility */
    padding: 35px;
    border-radius: 28px;
    width: 550px;
    max-width: 95%;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Worker Status Indicator */
.worker-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pulsing-dot {
    width: 10px;
    height: 10px;
    background-color: #34d399;
    /* Success Green */
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
}

.pulsing-dot.offline {
    background-color: #f87171;
    /* Danger Red */
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.worker-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
}

.worker-subtext {
    font-size: 0.75rem;
    color: #94a3b8;
}