/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a1a;
    --primary-dark: #000000;
    --primary-light: #2d2d2d;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation */
nav {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    color: white;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Increased z-index for mobile overlap safety */
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 0;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    display: inline-block;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 500;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

nav a.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* Cards */
.card {
    background: var(--card-bg);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Typography */
h1 {
    font-size: 1.75rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 700;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    margin: 15px 0 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
}

table {
    width: 100% !important;
    border-collapse: collapse;
    min-width: 600px;
    max-width: 100%;
    table-layout: auto;
}

th,
td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

th {
    background: #1a1a1a;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    margin: 5px 0 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Buttons */
button {
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

button.danger {
    background: var(--danger-color);
}

button.danger:hover {
    background: #dc2626;
}

button.success {
    background: var(--secondary-color);
}

button.success:hover {
    background: #059669;
}

button.info {
    background: var(--info-color);
}

button.info:hover {
    background: #0891b2;
}

button.warning {
    background: var(--warning-color);
}

button.warning:hover {
    background: #d97706;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button Classes for Links */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 8px;
    line-height: normal;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-dark);
}

.btn.secondary {
    background: #e2e8f0;
    color: var(--text-primary);
}

.btn.secondary:hover {
    background: #cbd5e1;
}

/* Alerts */
.alert.success,
.alert.error,
.alert.info {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--secondary-color);
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert.info {
    background: #e0f2fe;
    color: #075985;
    border-left: 4px solid var(--info-color);
}

/* Alert Mobile Responsive */
@media (max-width: 768px) {

    .alert.success,
    .alert.error,
    .alert.info {
        padding: 12px;
        font-size: 0.9rem;
        line-height: 1.5;
        flex-direction: row;
        align-items: flex-start;
    }
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: inline-block;
    font-weight: 600;
    white-space: nowrap;
}

.badge.scheduled {
    background: #d1fae5;
    color: #065f46;
}

.badge.completed {
    background: #dbeafe;
    color: #1e40af;
}

.badge.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.badge.active {
    background: #dbeafe;
    color: #1e40af;
}

.badge.kelas {
    background: #fef3c7;
    color: #92400e;
}

.badge.privat {
    background: #e0e7ff;
    color: #3730a3;
}

.badge.success {
    background: #d1fae5;
    color: #065f46;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

/* Stat Box */
.stat-box {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 20px;
    margin: 10px 0;
    border-radius: 12px;
    color: white;
    box-shadow: var(--shadow-md);
}

.stat-box strong {
    font-size: 2rem;
    display: block;
    margin-bottom: 5px;
}

.stat-box span {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Schedule Group */
.schedule-group {
    border: 2px solid var(--border-color);
    padding: 20px;
    margin: 15px 0;
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.schedule-group:hover {
    box-shadow: var(--shadow-md);
}

.schedule-group.past {
    opacity: 0.6;
    background: #f1f5f9;
}

.schedule-group.completed {
    border-color: var(--secondary-color);
    background: #d1fae5;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.schedule-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 10px 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.schedule-info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Participants */
.participants-list {
    margin: 15px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
}

.participant-item {
    padding: 12px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 10px;
}

.participant-info {
    flex: 1;
    min-width: 150px;
}

.participant-actions {
    display: flex;
    gap: 5px;
}

.customer-checkbox {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: #f8fafc;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.customer-checkbox:hover {
    background: #f1f5f9;
}

.customer-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
    cursor: pointer;
}

.customer-list-scroll {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    background: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    margin: 20px auto;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 20px;
}

.close:hover {
    color: var(--danger-color);
    transform: scale(1.1);
}

/* Modal Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 3% auto;
        padding: 20px;
        max-height: 94vh;
        overflow-y: auto;
    }

    .close {
        font-size: 32px;
        line-height: 24px;
        padding: 8px;
    }

    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .modal-content label {
        font-size: 0.9rem;
    }

    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 12px;
    }

    .modal-content button {
        padding: 12px 24px;
        font-size: 1rem;
        min-height: 44px;
        /* Touch target minimum */
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 16px;
        max-height: 100vh;
        border-radius: 0;
    }

    .close {
        font-size: 36px;
        padding: 10px;
    }
}

/* DataTables Mobile Styling */
.dataTables_wrapper {
    padding: 0;
    width: 100%;
    overflow-x: auto;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
    display: block;
    width: 100%;
}

.dataTables_wrapper .dataTables_filter {
    text-align: left;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    margin-left: 10px;
    width: auto;
    max-width: 200px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 10px;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 15px;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 15px;
    text-align: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    background: white !important;
    color: #1e293b !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8fafc !important;
    color: #94a3b8 !important;
}

/* Additional specific selectors to override DataTables defaults */
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next {
    color: #1e293b !important;
    background: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.previous:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.next:hover {
    color: #1e293b !important;
    background: #f1f5f9 !important;
    border: 1px solid var(--border-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: white !important;
    background: #1a1a1a !important;
    border: 1px solid #1a1a1a !important;
}

/* DataTable Scrolling */
.dataTables_scrollBody {
    overflow-x: auto !important;
}

div.dataTables_wrapper div.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    margin-left: -100px;
    margin-top: -26px;
    text-align: center;
    padding: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before,
table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control:before {
    background-color: var(--primary-color);
    border-radius: 4px;
}

/* Force table to not exceed container */
table.dataTable {
    width: 100% !important;
    margin: 0 !important;
}

table.dataTable thead th,
table.dataTable thead td {
    border-bottom: 1px solid var(--border-color);
}

table.dataTable tbody th,
table.dataTable tbody td {
    padding: 12px 8px;
}

/* Action Buttons Group */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive Utilities */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.pwa-install-banner.show {
    display: block;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.pwa-banner-text h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.pwa-banner-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pwa-banner-actions {
    display: flex;
    gap: 10px;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Action Buttons - Clean Layout */
.action-buttons-container {
    width: 100%;
}

.primary-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.primary-actions button,
.primary-actions form button {
    flex: 1;
    min-width: 80px;
    padding: 8px 6px;
    font-size: 0.75rem;
}

.primary-actions form {
    flex: 1;
    margin: 0;
}

.more-actions {
    margin-top: 5px;
}

.more-actions summary {
    cursor: pointer;
    padding: 6px 10px;
    background: #f1f5f9;
    border-radius: 5px;
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    user-select: none;
}

.more-actions summary:hover {
    background: #e2e8f0;
}

.more-actions[open] summary {
    background: #6c757d;
    color: white;
    margin-bottom: 8px;
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.actions-grid button,
.actions-grid form button {
    width: 100%;
    padding: 8px 6px;
    font-size: 0.75rem;
}

.actions-grid form {
    margin: 0;
}

@media (max-width: 768px) {
    .primary-actions {
        gap: 8px;
    }

    .primary-actions button,
    .primary-actions form button {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .actions-grid button,
    .actions-grid form button {
        padding: 10px 8px;
        min-height: 42px;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* iOS Safe Area Support */
    @supports (padding: max(0px)) {
        body {
            padding-left: max(0px, env(safe-area-inset-left));
            padding-right: max(0px, env(safe-area-inset-right));
        }
    }

    /* Dropdown Menu Styles */
    .dropdown-wrapper {
        position: relative;
        width: 100%;
    }

    .dropdown-toggle {
        width: 100%;
        background: #6c757d;
        color: white;
        border: none;
        padding: 10px;
        border-radius: 5px;
        cursor: pointer;
        font-size: 0.85rem;
        font-weight: 500;
    }

    .dropdown-toggle:hover {
        background: #5a6268;
    }

    .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        min-width: 200px;
        z-index: 1000;
        margin-top: 5px;
    }

    .dropdown-menu.show {
        display: block;
    }

    .dropdown-menu button,
    .dropdown-menu form button {
        width: 100%;
        text-align: left;
        padding: 12px 15px;
        border: none;
        background: white;
        cursor: pointer;
        font-size: 0.9rem;
        border-bottom: 1px solid #f0f0f0;
        transition: background 0.2s;
    }

    .dropdown-menu button:hover,
    .dropdown-menu form button:hover {
        background: #f8f9fa;
    }

    .dropdown-menu button.warning {
        color: #f59e0b;
    }

    .dropdown-menu button.danger,
    .dropdown-menu form button.danger {
        color: #ef4444;
    }

    .dropdown-menu form {
        margin: 0;
    }

    .dropdown-menu button:last-child,
    .dropdown-menu form:last-child button {
        border-bottom: none;
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }

    .dropdown-menu button:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }

    /* Mobile responsive dropdown */
    @media (max-width: 768px) {
        .dropdown-menu {
            left: 0;
            right: auto;
            min-width: 180px;
        }

        .dropdown-wrapper {
            grid-column: span 2;
        }

        .action-buttons-grid {
            grid-template-columns: 1fr 1fr;
        }
    }

    @media screen and (max-width: 768px) {
        .nav-container {
            flex-direction: column;
            padding: 8px 12px;
            gap: 8px;
        }

        .nav-brand {
            font-size: 1.1rem;
            padding: 10px 0;
        }

        .nav-brand-icon {
            width: 28px;
            height: 28px;
        }

        nav a {
            padding: 12px 16px;
            font-size: 0.9rem;
            min-height: 44px;
            /* Touch target */
            display: flex;
            align-items: center;
        }

        .nav-links {
            width: 100%;
            justify-content: flex-start;
            padding: 5px 0 10px 0;
        }

        .container {
            padding: 8px;
        }

        h2 {
            font-size: 1.25rem;
        }
    }

    h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    button {
        width: 100%;
        margin-right: 0;
        justify-content: center;
    }

    .action-buttons button {
        width: auto;
        flex: 1;
    }

    /* DataTables Mobile Fixes */
    .dataTables_wrapper {
        width: 100%;
        overflow-x: hidden;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 10px;
        width: 100%;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: 100%;
        margin: 10px 0 0 0;
        display: block;
    }

    .dataTables_wrapper .dataTables_length select {
        margin: 5px 0;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        font-size: 0.85rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 6px 10px;
        font-size: 0.85rem;
        margin: 2px;
    }

    /* Table wrapper mobile */
    .table-container {
        width: 100%;
        overflow-x: auto;
        border: none;
        border-radius: 0;
    }

    table {
        min-width: 500px;
        font-size: 0.85rem;
        width: 100% !important;
    }

    th,
    td {
        padding: 10px 6px;
        font-size: 0.85rem;
    }

    th {
        font-size: 0.8rem;
        padding: 10px 6px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px auto;
    }

    .schedule-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .schedule-info {
        flex-direction: column;
        gap: 8px;
    }

    .participant-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .participant-actions {
        width: 100%;
    }

    .participant-actions button {
        flex: 1;
    }

    .stat-box strong {
        font-size: 1.75rem;
    }

    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .pwa-install-banner {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    nav a {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .stat-box {
        padding: 15px;
    }

    .pwa-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .pwa-banner-actions {
        flex-direction: column;
    }

    .pwa-banner-actions button {
        width: 100%;
    }
}

/* Print Styles */
@media print {

    nav,
    .action-buttons,
    button {
        display: none;
    }

    .container {
        max-width: 100%;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ================================================
   DataTables Fix - Prevent Offside/Overflow Issues
   ================================================ */

/* Container fixes */
.dataTables_wrapper {
    width: 100% !important;
    max-width: 100%;
    overflow: visible;
    padding: 0;
    margin: 0;
}

/* Table wrapper */
.dataTables_wrapper .dataTables_scroll {
    width: 100% !important;
    overflow-x: auto;
}

.dataTables_wrapper .dataTables_scrollBody {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Table itself */
table.dataTable {
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
}

/* Ensure header alignment */
table.dataTable thead th,
table.dataTable thead td {
    padding: 12px 8px;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

table.dataTable tbody td {
    padding: 12px 8px;
    white-space: nowrap;
}

/* Filter and length controls */
.dataTables_wrapper .dataTables_length {
    float: none;
    text-align: left;
    padding-bottom: 10px;
    width: 100%;
}

.dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: left;
    padding-bottom: 10px;
    width: 100%;
}

.dataTables_wrapper .dataTables_filter label {
    display: block;
    width: 100%;
}

.dataTables_wrapper .dataTables_filter input {
    width: 100%;
    max-width: 300px;
    margin-left: 0.5em;
    box-sizing: border-box;
}

/* Info and pagination */
.dataTables_wrapper .dataTables_info {
    clear: both;
    float: none;
    padding-top: 15px;
    width: 100%;
    text-align: left;
}

.dataTables_wrapper .dataTables_paginate {
    float: none;
    text-align: center;
    padding-top: 15px;
    width: 100%;
}

/* Pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    box-sizing: border-box;
    display: inline-block;
    min-width: 1.5em;
    padding: 0.5em 1em;
    margin-left: 2px;
    text-align: center;
    cursor: pointer;
}

/* Processing indicator */
.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    margin-left: -100px;
    margin-top: -26px;
    text-align: center;
    padding: 1em 0;
}

/* Responsive specific */
table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control,
table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
}

table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before,
table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control:before {
    top: 50%;
    left: 5px;
    height: 16px;
    width: 16px;
    margin-top: -8px;
    display: block;
    position: absolute;
    color: white;
    border: 2px solid white;
    border-radius: 16px;
    box-shadow: 0 0 3px #444;
    box-sizing: content-box;
    text-align: center;
    text-indent: 0 !important;
    font-family: 'Courier New', Courier, monospace;
    line-height: 16px;
    content: '+';
    background-color: #31b131;
}

/* Mobile specific fixes */
@media screen and (max-width: 768px) {

    /* Make everything stack on mobile */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        width: 100%;
        margin-bottom: 10px;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: 100%;
        margin: 5px 0 0 0;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        width: 100%;
    }

    /* Smaller padding on mobile */
    table.dataTable thead th,
    table.dataTable thead td,
    table.dataTable tbody td {
        padding: 8px 4px;
        font-size: 0.85rem;
    }

    /* Pagination buttons smaller */
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3em 0.7em;
        font-size: 0.85rem;
        margin: 1px;
    }

    /* Reduce font size */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info {
        font-size: 0.9rem;
    }
}

/* Tablet fixes */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    table.dataTable {
        font-size: 0.95rem;
    }

    table.dataTable thead th,
    table.dataTable thead td,
    table.dataTable tbody td {
        padding: 10px 6px;
    }
}

/* Force scroll on small screens */
@media screen and (max-width: 640px) {
    .dataTables_wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    table.dataTable {
        min-width: 0 !important;
        width: 100% !important;
    }
}

/* Fix for action buttons in table */
table.dataTable td button,
table.dataTable td .action-buttons {
    white-space: nowrap;
}

table.dataTable td button {
    margin: 2px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Mobile-specific table button fixes */
@media (max-width: 768px) {

    /* Force action column to be vertical flex container */
    table.dataTable tbody td.action-column,
    table tbody td.action-column {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        align-items: stretch !important;
        min-width: 100px;
        max-width: 150px;
    }

    /* Make table buttons more compact on mobile */
    table.dataTable td button,
    table tbody td button {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
        margin: 2px 0 !important;
        white-space: nowrap;
        width: 100% !important;
        min-width: auto !important;
        display: block !important;
    }

    /* Forms inside td should also be full width */
    table.dataTable tbody td.action-column form,
    table tbody td.action-column form {
        width: 100%;
        margin: 0 !important;
    }

    /* Action buttons container in tables */
    table.dataTable td .action-buttons,
    table tbody td .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 100%;
    }

    table.dataTable td .action-buttons button,
    table tbody td .action-buttons button {
        width: 100% !important;
        flex: none !important;
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
    }

    /* Prevent table overflow */
    table.dataTable,
    table {
        table-layout: auto !important;
    }

    /* Allow horizontal scroll if needed */
    .dataTables_wrapper {
        overflow-x: auto !important;
    }

    .card {
        overflow-x: auto !important;
    }

    /* Force hide columns with className 'none' on mobile */
    table.dataTable thead th.none,
    table.dataTable tbody td.none {
        display: none !important;
    }

    /* Force hide columns with className 'min-tablet' on mobile */
    table.dataTable thead th.min-tablet,
    table.dataTable tbody td.min-tablet {
        display: none !important;
    }

    /* Specifically hide action column (7th column) on mobile */
    #customerTable thead th:nth-child(7),
    #customerTable tbody td:nth-child(7) {
        display: none !important;
    }

    /* Make child row (expanded details) follow table width */
    table.dataTable tbody tr.child {
        width: 100% !important;
    }

    table.dataTable tbody tr.child ul.dtr-details {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
    }

    table.dataTable tbody tr.child ul.dtr-details li {
        padding: 8px 0 !important;
        border-bottom: 1px solid #f0f0f0;
        word-wrap: break-word;
    }

    /* Target the td element in child row */
    table.dataTable tbody tr.child td {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* Ensure buttons in child row are full width */
    table.dataTable tbody tr.child td button {
        width: 100% !important;
        margin: 4px 0 !important;
    }

    /* Mobile action buttons - 2 column grid */
    .action-buttons-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .action-buttons-grid button,
    .action-buttons-grid form button {
        width: 100%;
        padding: 10px 8px;
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: 42px;
    }

    .action-buttons-grid form {
        display: block;
    }
}

/* Clearfix */
.dataTables_wrapper:after {
    visibility: hidden;
    display: block;
    content: "";
    clear: both;
    height: 0;
}

/* Fix width issues */
.dataTables_wrapper .row {
    margin: 0;
}

.dataTables_wrapper .row:after {
    content: "";
    display: table;
    clear: both;
}

/* Ensure no overflow */
.card .dataTables_wrapper {
    overflow: visible;
}

/* Fix header alignment issues */
table.dataTable>thead>tr>th {
    vertical-align: bottom;
}

table.dataTable>thead>tr>th,
table.dataTable>thead>tr>td {
    padding: 12px 8px;
}

/* Row hover effect */
table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover {
    background-color: #f5f5f5;
}

/* Selected row */
table.dataTable tbody tr.selected {
    background-color: #b0bed9;
}

/* Fix sorting icons */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_desc:after {
    opacity: 0.3;
}

/* Column visibility button */
.dt-button {
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.dt-button:hover {
    background: #f5f5f5;
}

/* Fix for very small screens */
@media screen and (max-width: 480px) {
    table.dataTable {
        font-size: 0.8rem;
    }

    table.dataTable thead th,
    table.dataTable thead td,
    table.dataTable tbody td {
        padding: 6px 3px;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.2em 0.5em;
        font-size: 0.75rem;
    }
}

/* ================================================
   FINAL OVERRIDE - DataTables Pagination Colors
   Must be at the end to override all other rules
   ================================================ */

/* Force pagination button colors */
table.dataTable tbody tr,
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next,
.dataTables_wrapper .dataTables_paginate .paginate_button:active,
.dataTables_wrapper .dataTables_paginate .paginate_button:focus {
    color: #1e293b !important;
    background-color: white !important;
    background: white !important;
    border: 1px solid #e2e8f0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.previous:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.next:hover {
    color: #1e293b !important;
    background-color: #f1f5f9 !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:active,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:focus {
    color: white !important;
    background-color: #1a1a1a !important;
    background: #1a1a1a !important;
    border: 1px solid #1a1a1a !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
    color: #94a3b8 !important;
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}