/**
 * FILE: /var/138casino/public/admin/agent.css
 * CSS cho trang quản lý đại lý
 */

/* =====================================================
   AGENT DASHBOARD STATS
   ===================================================== */

.agent-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.agent-stat-card {
    background: var(--card-bg, #1e2a3a);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border, #2d3a4a);
    transition: transform 0.2s, box-shadow 0.2s;
}

.agent-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.agent-stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.agent-stat-card .stat-icon.yellow { color: #ffd700; }
.agent-stat-card .stat-icon.green { color: #4ade80; }
.agent-stat-card .stat-icon.orange { color: #fb923c; }
.agent-stat-card .stat-icon.blue { color: #60a5fa; }
.agent-stat-card .stat-icon.purple { color: #c084fc; }
.agent-stat-card .stat-icon.red { color: #f87171; }

.agent-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.agent-stat-card .stat-label {
    font-size: 12px;
    color: var(--gray, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =====================================================
   SUBTABS NAVIGATION
   ===================================================== */

.agent-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px;
    background: var(--card-bg, #1e2a3a);
    border-radius: 10px;
    border: 1px solid var(--border, #2d3a4a);
}

.agent-subtab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--gray, #9ca3af);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-subtab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.agent-subtab.active {
    background: var(--primary, #3b82f6);
    color: #fff;
}

.agent-subtab i {
    font-size: 14px;
}

/* =====================================================
   AGENT CONTENT AREA
   ===================================================== */

.agent-content-area {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.agent-main-content {
    min-width: 0;
}

.agent-sidebar {
    min-width: 0;
}

/* =====================================================
   FILTER BAR
   ===================================================== */

.agent-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.agent-filter-bar select,
.agent-filter-bar input {
    padding: 10px 14px;
    background: var(--card-bg, #1e2a3a);
    border: 1px solid var(--border, #2d3a4a);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    min-width: 150px;
}

.agent-filter-bar input {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.agent-filter-bar select:focus,
.agent-filter-bar input:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}

.agent-filter-bar .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =====================================================
   AGENTS GRID
   ===================================================== */

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.agent-card {
    background: var(--card-bg, #1e2a3a);
    border-radius: 12px;
    border: 1px solid var(--border, #2d3a4a);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agent-code {
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.agent-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    text-transform: uppercase;
}

.agent-status.status-active,
.status-active {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.agent-status.status-pending,
.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.agent-status.status-suspended,
.status-suspended {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.agent-status.status-rejected,
.status-rejected {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}

.agent-rate {
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
}

.agent-body {
    padding: 16px;
}

.agent-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.agent-phone {
    font-size: 13px;
    color: var(--gray, #9ca3af);
    margin-bottom: 16px;
}

.agent-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.agent-stats .stat {
    text-align: center;
}

.agent-stats .stat .label {
    font-size: 11px;
    color: var(--gray, #9ca3af);
    display: block;
    margin-bottom: 4px;
}

.agent-stats .stat .value {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.agent-balance {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.agent-balance .balance-item {
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

.agent-balance .balance-item .label {
    font-size: 10px;
    color: var(--gray, #9ca3af);
    display: block;
    margin-bottom: 2px;
}

.agent-balance .balance-item .value {
    font-size: 12px;
    font-weight: 600;
    color: #4ade80;
}

.agent-balance .balance-item.negative .value {
    color: #f87171;
}

.agent-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border, #2d3a4a);
}

.agent-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* =====================================================
   TOP AGENTS SIDEBAR
   ===================================================== */

.top-agents-card {
    background: var(--card-bg, #1e2a3a);
    border-radius: 12px;
    border: 1px solid var(--border, #2d3a4a);
    padding: 20px;
}

.top-agents-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
}

.top-agent-item:last-child {
    margin-bottom: 0;
}

.top-agent-item .rank {
    font-size: 14px;
    font-weight: 700;
    color: #ffd700;
    min-width: 30px;
}

.top-agent-item .name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    display: block;
}

.top-agent-item .code {
    font-size: 11px;
    color: var(--gray, #9ca3af);
    font-family: monospace;
}

.top-agent-item .earned {
    margin-left: auto;
    font-size: 14px;
    font-weight: 600;
    color: #4ade80;
}

/* =====================================================
   EMPTY STATE
   ===================================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg, #1e2a3a);
    border: 2px dashed var(--border, #2d3a4a);
    border-radius: 12px;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray, #9ca3af);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--gray, #9ca3af);
    font-size: 16px;
}

/* =====================================================
   SUBTAB PANELS
   ===================================================== */

.agent-subtab-panel {
    display: none;
}

.agent-subtab-panel.active {
    display: block;
}

/* =====================================================
   TIERS CONFIGURATION
   ===================================================== */

.tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tier-card {
    background: var(--card-bg, #1e2a3a);
    border-radius: 12px;
    border: 1px solid var(--border, #2d3a4a);
    overflow: hidden;
}

.tier-card.inactive {
    opacity: 0.6;
}

.tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.tier-level {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary, #3b82f6);
}

.tier-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.tier-body {
    padding: 16px;
}

.tier-body > div {
    margin-bottom: 12px;
}

.tier-body > div:last-child {
    margin-bottom: 0;
}

.tier-body label {
    display: block;
    font-size: 12px;
    color: var(--gray, #9ca3af);
    margin-bottom: 6px;
}

.tier-body input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border, #2d3a4a);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}

.tier-body input[type="checkbox"] {
    margin-right: 8px;
}

/* =====================================================
   SETTINGS FORM
   ===================================================== */

.settings-form {
    background: var(--card-bg, #1e2a3a);
    border-radius: 12px;
    border: 1px solid var(--border, #2d3a4a);
    padding: 24px;
    max-width: 600px;
}

.settings-form h3 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--gray, #9ca3af);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border, #2d3a4a);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}

.form-group .hint {
    font-size: 12px;
    color: var(--gray, #9ca3af);
    margin-top: 6px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.checkbox-group label {
    margin-bottom: 0;
    color: #fff;
}

/* =====================================================
   WITHDRAWALS TABLE
   ===================================================== */

.withdrawals-container {
    background: var(--card-bg, #1e2a3a);
    border-radius: 12px;
    border: 1px solid var(--border, #2d3a4a);
    overflow: hidden;
}

.withdrawals-container .table-container {
    overflow-x: auto;
}

.withdrawals-container table {
    width: 100%;
    border-collapse: collapse;
}

.withdrawals-container th,
.withdrawals-container td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.withdrawals-container th {
    background: rgba(0, 0, 0, 0.2);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray, #9ca3af);
    text-transform: uppercase;
}

.withdrawals-container td {
    font-size: 14px;
    color: #fff;
}

.withdrawals-container tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* =====================================================
   MODALS
   ===================================================== */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border, #2d3a4a);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* User search in modal */
.user-search-container {
    position: relative;
    margin-bottom: 20px;
}

.user-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg, #1e2a3a);
    border: 1px solid var(--border, #2d3a4a);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border, #2d3a4a);
    transition: background 0.2s;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.user-selected {
    padding: 12px 16px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 8px;
    margin-top: 10px;
}

/* Agent detail modal */
.agent-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.agent-detail-info h3 {
    font-size: 20px;
    color: #fff;
    margin-bottom: 4px;
}

.agent-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.detail-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 16px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary, #3b82f6);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--gray, #9ca3af);
    font-size: 13px;
}

.detail-row .value {
    color: #fff;
    font-weight: 500;
    font-size: 13px;
}

/* Detail tabs */
.detail-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border, #2d3a4a);
}

.detail-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--gray, #9ca3af);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

.detail-tab:hover {
    color: #fff;
}

.detail-tab.active {
    color: var(--primary, #3b82f6);
}

.detail-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary, #3b82f6);
}

.detail-tab-panel {
    display: none;
}

.detail-tab-panel.active {
    display: block;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1200px) {
    .agent-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .agent-content-area {
        grid-template-columns: 1fr;
    }
    
    .agent-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .agent-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .agent-subtabs {
        flex-wrap: wrap;
    }
    
    .agent-subtab {
        flex: 1;
        min-width: calc(50% - 4px);
        justify-content: center;
    }
    
    .agents-grid {
        grid-template-columns: 1fr;
    }
    
    .agent-filter-bar {
        flex-direction: column;
    }
    
    .agent-filter-bar select,
    .agent-filter-bar input {
        width: 100%;
        max-width: none;
    }
}

/* =====================================================
   LOADING STATE
   ===================================================== */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border, #2d3a4a);
    border-top-color: var(--primary, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   BADGES
   ===================================================== */

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.badge-danger {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.badge-info {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.badge-secondary {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}
/* =====================================================
   AGENT MOBILE RESPONSIVE ENHANCEMENTS
   ===================================================== */

@media (max-width: 768px) {
  /* Agent stat cards touch-friendly */
  .agent-stat-card {
    padding: 14px;
  }
  .agent-stat-card .stat-value {
    font-size: 20px;
  }
  .agent-stat-card .stat-icon {
    font-size: 22px;
  }

  /* Agent subtabs touch targets */
  .agent-subtab {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }

  /* Agent filter bar full width */
  .agent-filter-bar .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* Agent cards single column */
  .agents-grid {
    grid-template-columns: 1fr !important;
  }

  /* Agent card actions touch-friendly */
  .agent-actions .btn {
    min-height: 40px;
    font-size: 13px;
  }

  /* Tiers grid single column */
  .tiers-grid {
    grid-template-columns: 1fr !important;
  }

  /* Agent detail grid single column */
  .agent-detail-grid {
    grid-template-columns: 1fr;
  }

  /* Agent detail header stack */
  .agent-detail-header {
    flex-direction: column;
    gap: 12px;
  }

  /* Detail tabs scrollable */
  .detail-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .detail-tab {
    white-space: nowrap;
    min-height: 44px;
    padding: 12px 14px;
    font-size: 13px;
  }

  /* Withdrawals table scrollable */
  .withdrawals-container .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .withdrawals-container table {
    min-width: 600px;
  }
  .withdrawals-container th,
  .withdrawals-container td {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Settings form full width */
  .settings-form {
    max-width: 100%;
    padding: 16px;
  }

  /* Modal body padding */
  .modal-body {
    padding: 16px;
  }
  .modal-header {
    padding: 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-direction: column;
  }
  .modal-footer .btn {
    width: 100%;
    min-height: 44px;
  }

  /* Top agents card */
  .top-agents-card {
    padding: 14px;
  }
  .top-agent-item {
    padding: 10px;
  }

  /* Agent balance items */
  .agent-balance {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .agent-balance .balance-item .value {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .agent-stats-grid {
    grid-template-columns: 1fr !important;
  }

  .agent-subtab {
    min-width: 100%;
  }

  .agent-stats .stat .value {
    font-size: 14px;
  }

  .agent-balance {
    grid-template-columns: 1fr;
  }

  .agent-actions {
    flex-wrap: wrap;
  }
  .agent-actions .btn {
    min-width: calc(50% - 4px);
  }
}
