* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --danger-color: #ff00002e;
    --warning-color: #f59e0b;
    --dark-bg: #1e293b;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #000000 0%, #000000 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.header-content h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-content h1 i {
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.dashboard {
    display: grid;
    gap: 25px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card h2 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 i {
    color: var(--primary-color);
}

/* Control Panel */
.control-panel {
    background: linear-gradient(135deg, #2e4043 0%, #1a2223 100%);
    color: white;
}

.control-panel h2 {
    color: white;
}

.control-panel h2 i {
    color: white;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: end;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-item label {
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.9;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input[type="number"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgb(0 0 0 / 48%);
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

.input-group input[type="number"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.input-group select {
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgb(0 0 0 / 48%);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.input-group select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.input-group select option {
    background: var(--dark-bg);
    color: white;
}

/* Toggle Switch */
.toggle-switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-label {
    display: block;
    width: 80px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.toggle-label::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-label {
    background: var(--success-color);
    border-color: var(--success-color);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-label::after {
    transform: translateX(40px);
}

.toggle-text-off,
.toggle-text-on {
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.3s, opacity 0.3s;
    min-width: 35px;
    text-align: center;
}

.toggle-text-off {
    color: white;
    opacity: 1;
}

.toggle-text-on {
    color: rgba(255, 255, 255, 0.5);
    opacity: 0.7;
}

.toggle-switch-container.active .toggle-text-off {
    color: rgba(255, 255, 255, 0.5);
    opacity: 0.7;
}

.toggle-switch-container.active .toggle-text-on {
    color: white;
    opacity: 1;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: rgb(0 0 0 / 48%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: #006a19;
    color: white;
    border: solid 2px #5f5f5f;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn i {
    font-size: 0.9rem;
}

/* Add Domain Panel */
.add-domain-panel {
    background: linear-gradient(135deg, #474747 0%, #141414 100%);
    color: white;
}

.add-domain-panel h2 {
    color: white;
}

.add-domain-panel h2 i {
    color: white;
}

.add-domain-form {
    display: flex;
    gap: 15px;
}

.add-domain-form input[type="text"] {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgb(0 0 0 / 48%);
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

.add-domain-form input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.add-domain-form input[type="text"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

/* Domain List Panel */
.domain-list-panel {
    background: #353535;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.domain-count {
    background: #111717;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Custom Scrollbar Styling untuk WebKit browsers (Chrome, Safari, Edge) */
.table-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #212728 0%, #273f43 100%);
    border-radius: 10px;
    border: 2px solid #f1f5f9;
    transition: all 0.3s ease;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.table-container::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #4c5fd1 0%, #5d3580 100%);
}

.table-container::-webkit-scrollbar-corner {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 10px;
}

/* Custom Scrollbar Styling untuk Firefox */
.table-container {
    scrollbar-width: thin;
    scrollbar-color: #353535 #f1f5f9;
}

/* Sticky header saat scroll */
.table-container table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.domain-table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1a1a;
}

.domain-table thead {
    background: linear-gradient(135deg, #273f43 0%, #273f43 100%);
    color: white;
}

.domain-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domain-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.domain-table tbody tr:hover {
    background: #545454;
}

.domain-table tbody tr.empty-row:hover {
    background: white;
}

.domain-table tbody tr.selected {
    background: #e0e7ff;
}

.domain-table tbody tr.selected:hover {
    background: #c7d2fe;
}

.domain-table td {
    padding: 15px;
    font-size: 0.95rem;
}

/* White text for specific columns: No, Domain, Terakhir Dicek, Terkena Nawala */
/* No column - when no checkbox: nth-child(1), when checkbox exists: nth-child(2) */
.domain-table:not(.select-mode) tbody tr:not(.empty-row) > td:nth-child(1),
.domain-table.select-mode tbody tr:not(.empty-row) > td:nth-child(2):not(.select-cell) {
    color: white !important;
}

/* Domain column - when no checkbox: nth-child(2), when checkbox exists: nth-child(3) */
.domain-table:not(.select-mode) tbody tr:not(.empty-row) > td:nth-child(2) strong,
.domain-table.select-mode tbody tr:not(.empty-row) > td:nth-child(3) strong {
    color: white !important;
}

/* Terakhir Dicek and Terkena Nawala columns (time-cell class) */
.domain-table tbody td.time-cell {
    color: white !important;
}

/* Ensure white color for domain name text inside Domain column */
.domain-table tbody td strong {
    color: white !important;
}

.domain-table td.select-cell {
    text-align: center;
    width: 50px;
}

.domain-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.domain-table thead th input[type="checkbox"] {
    cursor: pointer;
}

.domain-table.select-mode tbody tr {
    cursor: pointer;
}

.domain-table.select-mode tbody tr:not(.empty-row):hover {
    background: #545454;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-nawala {
    background: #fee2e2;
    color: rgb(255, 57, 57);
    border: 1px solid var(--danger-color);
}

.status-aman {
    background: #d1fae5;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.status-pending {
    background: #fef3c7;
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.empty-message {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.empty-message i {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

.time-cell {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #212728 0%, #273f43 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
}

.modal-header h2 i {
    color: white;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-body textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 200px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8rem;
    }

    .control-grid {
        grid-template-columns: 1fr;
    }

    .add-domain-form {
        flex-direction: column;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .domain-table {
        font-size: 0.85rem;
    }

    .domain-table th,
    .domain-table td {
        padding: 10px 8px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .modal-header,
    .modal-body {
        padding: 20px;
    }
}

/* WhatsApp Configuration Styles */
.whatsapp-status-section {
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 20px;
}

.whatsapp-status-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    margin-bottom: 15px;
}

.whatsapp-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.whatsapp-groups-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.group-item:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
}

.group-info {
    flex: 1;
}

.group-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.group-id {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.group-actions {
    display: flex;
    gap: 10px;
}

.status-badge.status-connected {
    background: #d1fae5;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.status-badge.status-disconnected {
    background: #fee2e2;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.status-badge i {
    font-size: 0.7rem;
    margin-right: 5px;
}

#qrCodeDisplay {
    max-width: 300px;
}

#qrCodeDisplay img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

