/* =================================================================
   Dashboard-Specific Styles
   ================================================================= */

body {
    display: block; /* Override the flex layout from the main style.css */
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: auto;
    background: var(--card-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to right, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 15px 25px;
    border-bottom: 3px solid var(--primary-dark);
}

.header h2 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    margin: 0;
}

.header-user {
    font-size: 0.9rem;
}

.controls {
    display: inline-flex;
    gap: 10px;
}

.controls button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 6px 12px;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: background .2s;
}

.controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Status Bar --- */
.status-bar {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    background: var(--background-color-light);
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    gap: 15px;
}

.status-item {
    text-align: center;
    font-size: 0.9rem;
    background: var(--card-color);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.status-item:hover {
   transform: translateY(-3px);
}

.status-item .text {
   font-size: 0.9em;
   display: flex;
   flex-direction: column;
   align-items: center;
}

.status-item .main-status {
   font-weight: 500;
}

.status-item .sub-status {
   font-size: 0.8em;
   color: var(--text-color-light);
   margin-top: 2px;
}

.status-item .icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.status-item.online .icon {
    color: var(--primary-light);
}

.status-item.offline .icon {
    color: var(--danger-color);
}

/* --- QR Box --- */
.qr-box {
    text-align: center;
    padding: 30px 20px;
    background: var(--card-color);
    border-bottom: 1px solid var(--border-color);
}

.qr-box h3 {
    margin-bottom: 15px;
}

.qr-box img {
    width: 220px;
    height: 220px;
    border: 5px solid var(--primary-color);
    border-radius: 12px;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    background: var(--background-color); /* A slightly different background */
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    padding: 10px; /* Add some padding for the buttons */
    gap: 12px; /* Add gap between buttons */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--card-color);
}

.tabs::-webkit-scrollbar {
    height: 6px;
}

.tabs::-webkit-scrollbar-track {
    background: var(--card-color);
}

.tabs::-webkit-scrollbar-thumb {
    background-color: var(--primary-light);
    border-radius: 10px;
}

.tab-link {
    flex-shrink: 0;
    padding: 12px 20px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary-color);
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 50px; /* Pill shape */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tab-link i {
    transition: transform 0.3s ease;
}

.tab-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    color: #25D366; /* WhatsApp Green on hover */
    border-color: rgba(37, 211, 102, 0.3);
}

.tab-link:hover i {
    transform: scale(1.1);
}

.tab-link.active {
    color: #fff; /* White text for best contrast */
    background: linear-gradient(45deg, #128C7E, #25D366); /* WhatsApp Green Gradient */
    border-color: transparent;
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.7); /* Intense green glow */
    transform: translateY(-2px) scale(1.05); /* Slightly more pop */
}

.tab-link.active i {
    color: #fff;
    transform: scale(1.1) rotate(-5deg); /* Add a slight playful rotation */
}

.tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn .4s ease-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Queue List Styles --- */
.queue-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.queue-item {
    background-color: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-left-width: 5px;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for error messages */
    align-items: center;
    gap: 15px;
    transition: background-color 0.3s;
}

.queue-item .status-icon {
    font-size: 1.5em;
}

.queue-item .info {
    flex-grow: 1;
}

.queue-item .jid {
    font-weight: 500;
    color: var(--text-color);
}

.queue-item .message-preview {
    font-size: 0.9em;
    color: var(--text-secondary-color);
    margin-top: 4px;
}

.queue-item .timestamp {
    font-size: 0.8em;
    color: var(--text-secondary-color);
    white-space: nowrap;
}

.queue-item .error-info {
    flex-basis: 100%;
    margin-top: 10px;
    padding: 8px;
    background-color: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 0.85em;
    color: #ff8a8a;
    word-break: break-all;
}


/* Status Colors */
.queue-item.pending {
    border-left-color: #f0ad4e; /* Orange */
}
.queue-item.pending .status-icon {
    color: #f0ad4e;
}

.queue-item.sent {
    border-left-color: #5cb85c; /* Green */
}
.queue-item.sent .status-icon {
    color: #5cb85c;
}

.queue-item.failed {
    border-left-color: #d9534f; /* Red */
}
.queue-item.failed .status-icon {
    color: #d9534f;
}

/* --- Group List Styles --- */
.group-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.group-item {
    background-color: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all 0.2s ease-in-out;
}

.group-item:hover {
    background-color: var(--background-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.group-info .group-name {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-color);
    margin-bottom: 5px;
}

.group-info .group-id {
    font-size: 0.9em;
    color: var(--primary-light);
    background-color: rgba(0, 123, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-block;
}

.group-info .group-id:hover {
    background-color: rgba(0, 123, 255, 0.2);
}
/* --- New Send Options Styles --- */
.send-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.send-option-card {
    background-color: var(--input-bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
}

.send-option-card:hover {
    border-color: var(--primary-color-transparent);
    transform: translateY(-2px);
}

.send-option-card input[type="radio"] {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 1.2em;
    height: 1.2em;
}

.send-option-card .option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.send-option-card .option-content i {
    font-size: 1.8em;
    color: var(--primary-light);
    margin-bottom: 5px;
}

.send-option-card .option-content strong {
    font-size: 1.1em;
}

.send-option-card .option-content span {
    font-size: 0.85em;
    color: var(--text-secondary-color);
}

.send-option-card .sub-input-container {
    display: none; /* Hidden by default */
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

.send-option-card.active .sub-input-container {
    display: flex; /* Show when selected */
}

.send-option-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color-transparent);
}


.form-control-sm {
    width: 60px;
    padding: 5px 8px;
    font-size: 0.9em;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    text-align: center;
}
/* --- Tab Header & Filters --- */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tab-header h3 {
    margin: 0;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.filter-btn {
    background: var(--input-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary-color);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--background-color);
    color: var(--text-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
/* --- Server Stats Styles --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background-color: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-card h4 {
    margin: 0 0 15px 0;
    font-size: 1em;
    color: var(--text-secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.stat-card .stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-light);
}
/* --- User Info Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    border: 1px solid var(--border-color);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary-color);
    cursor: pointer;
}

.modal-user-details img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    margin-bottom: 15px;
}

.modal-user-details #modal-user-name {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 5px;
}

.modal-user-details #modal-user-id {
    font-size: 1em;
    color: var(--text-secondary-color);
    margin-bottom: 25px;
}
/* --- Admin User Table --- */
.table-container {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
}

.user-table th, .user-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.user-table thead th {
    background-color: var(--input-bg-color);
    font-weight: 600;
    color: var(--text-color);
}

.user-table tbody tr:hover {
    background-color: var(--background-color);
}

.user-table .status {
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
}

.user-table .status.active {
    background-color: rgba(0, 168, 132, 0.2);
    color: #00A884;
}

.user-table .status.inactive {
    background-color: rgba(220, 53, 69, 0.2);
    color: #DC3545;
}

.user-table .expired {
    color: var(--danger-color);
    font-weight: 700;
}

.user-table .btn-action {
    background: transparent;
    border: none;
    color: var(--text-secondary-color);
    cursor: pointer;
    font-size: 1.2em;
    margin: 0 5px;
    transition: color 0.2s;
}

.user-table .btn-action:hover {
    color: var(--primary-light);
}
/* --- Packages Grid --- */
.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.package-card {
    background: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.package-card h4 {
    color: var(--primary-light);
    margin: 0 0 10px 0;
}

.package-card .price {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 5px;
}

.package-card .price span {
    font-size: 0.5em;
    font-weight: 400;
}

.package-card .duration {
    font-size: 1em;
    color: var(--text-secondary-color);
}
/* --- Modal Form Scrolling --- */
.modal-content .modal-form {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 15px; /* Add padding for scrollbar */
}
/* --- Package Card Actions --- */
.package-card {
    position: relative;
}

.package-actions {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
}
/* --- Role Tags --- */
.role-tag {
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: capitalize;
}

.role-tag.role-admin {
    background-color: var(--danger-color-light);
    color: var(--danger-color);
}

.role-tag.role-staff {
    background-color: var(--primary-color-light);
    color: var(--primary-color);
}

.role-tag.role-user {
    background-color: var(--secondary-color-light);
    color: var(--secondary-color);
}
/* --- Permissions Page --- */
.permissions-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.staff-list-panel {
    width: 300px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    background-color: var(--background-color-light);
}

.staff-list-panel h4 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#permissions-staff-list .staff-item {
    padding: 10px;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    margin-bottom: 5px;
    transition: background-color 0.2s;
}

#permissions-staff-list .staff-item:hover {
    background-color: var(--hover-color);
}

#permissions-staff-list .staff-item.selected {
    background-color: var(--primary-color);
    color: white;
}

.permissions-panel {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    background-color: var(--background-color-light);
}

.permissions-panel h4 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

#permissions-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--background-color);
    padding: 10px;
    border-radius: var(--border-radius-sm);
}

.permission-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

#permissions-form button {
    margin-top: 10px;
}

#permissions-status {
    margin-top: 15px;
    font-weight: 500;
}
/* --- Add Deposit Modal --- */
#lastDepositInfo {
    color: var(--danger-color);
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9em;
}
/* --- Global Error Modal --- */
.modal-content.error-modal {
    max-width: 420px;
    text-align: center;
    padding-top: 20px;
}

.error-modal .error-icon {
    font-size: 3.5rem;
    color: var(--danger-color);
    margin-bottom: 15px;
    line-height: 1;
}

.error-modal h3 {
    margin-bottom: 10px;
    color: var(--danger-color);
}

.error-modal p {
    margin-bottom: 25px;
    font-size: 1.1em;
    color: var(--text-secondary-color);
}

.error-modal .btn {
    min-width: 120px;
}

/* --- Interface Management --- */
.interface-controls {
   padding: 20px;
   background: var(--background-color-light);
   border-radius: var(--border-radius);
   text-align: center;
}

.interface-controls .btn {
   padding: 12px 25px;
   font-size: 1.1rem;
}
/* --- Agent & Client Account Views --- */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.table-container th, .table-container td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.table-container thead th {
    background-color: var(--input-bg-color);
    font-weight: 600;
}

.table-container tbody tr:hover {
    background-color: var(--background-color);
}

.agent-balance-card {
    background: linear-gradient(to right, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.agent-balance-card h4 {
    margin: 0 0 10px 0;
}

.agent-balance-card p {
    font-size: 2.2em;
    font-weight: 700;
    margin: 0;
}
/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.settings-grid .card {
    margin-bottom: 0;
}
/* --- Professional Toggle Switch (iPhone Style) --- */
.form-switch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.form-switch:last-of-type {
    border-bottom: none;
}

.form-switch > label {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-switch input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 52px;
    height: 32px;
    background: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.form-switch input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.form-switch input[type="checkbox"]:checked {
    background: #25D366; /* WhatsApp Green */
    border-color: #25D366;
}

.form-switch input[type="checkbox"]:checked::before {
    transform: translateX(18px);
}

/* --- Account Modal Improvements --- */
.account-card {
    background-color: var(--input-bg-color);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.account-card-header {
    background: linear-gradient(to right, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.account-card-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.account-card-body {
    padding: 20px;
}

.account-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 10px;
    background-color: var(--input-bg-color);
    color: var(--text-color);
}

.action-btn i {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.action-btn span {
    font-weight: 500;
}

.action-btn.recharge-btn:hover {
    background-color: #25D366;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.action-btn.password-btn:hover {
    background-color: #0088cc;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 136, 204, 0.3);
}

.action-btn.history-btn:hover {
    background-color: #9c27b0;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(156, 39, 176, 0.3);
}

.action-btn.secondary-password-btn:hover {
    background-color: #ff9800;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3);
}

.account-section {
    background-color: var(--input-bg-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    display: none; /* Hidden by default */
    animation: fadeIn 0.3s ease-out;
}

.account-section.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.section-header i {
    font-size: 1.4rem;
    color: var(--primary-light);
}

/* Secondary Password Styles */
.secondary-password-container {
    margin-top: 15px;
}

.secondary-password-container .input-group {
    display: flex;
    margin-bottom: 15px;
}

.secondary-password-container .input-group input {
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.secondary-password-container .input-group button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.secondary-password-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.custom-secondary-password {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.custom-secondary-password h5 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}