/* Editors Common Styles */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    padding: 20px;
    font-size: 14px;
}

.container { max-width: 1600px; margin: 0 auto; }
h1 { margin-bottom: 5px; color: #333; }
.subtitle { color: #666; margin-bottom: 20px; font-size: 14px; }

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}
.back-link { color: #3040d6; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #3040d6; color: white; }
.btn-primary:hover:not(:disabled) { background: #2535b8; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover:not(:disabled) { background: #5a6268; }
.btn-success { background: #28a745; color: white; }
.btn-success:hover:not(:disabled) { background: #218838; }
.btn-warning { background: #ffc107; color: #333; }
.btn-danger { background: #dc3545; color: white; }
.btn-sm { padding: 4px 8px; font-size: 12px; }

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-group label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}
.filter-group select, .filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}
.filter-group input[type="text"] {
    width: 200px;
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}
.stat-item {
    text-align: center;
    padding: 0 15px;
    border-right: 1px solid #eee;
}
.stat-item:last-child { border-right: none; }
.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}
.stat-value.green { color: #28a745; }
.stat-value.orange { color: #fd7e14; }
.stat-value.red { color: #dc3545; }
.stat-value.blue { color: #3040d6; }
.stat-label { font-size: 12px; color: #666; margin-top: 4px; }

/* Table */
.table-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}
th {
    background: #3040d6;
    color: white;
    font-weight: 500;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}
th:hover { background: #2535b8; }
th.sorted-asc::after { content: ' ▲'; }
th.sorted-desc::after { content: ' ▼'; }
tr:hover { background: #f8f9fa; }
td.number { text-align: right; font-family: 'SF Mono', Monaco, monospace; }
td.actions { white-space: nowrap; }

/* Table header color variants */
.table-wrapper.orange th { background: #fd7e14; }
.table-wrapper.orange th:hover { background: #e8710a; }
.table-wrapper.gray th { background: #6c757d; }
.table-wrapper.gray th:hover { background: #5a6268; }
.table-wrapper.green th { background: #28a745; }
.table-wrapper.green th:hover { background: #218838; }

/* Row variants */
tr.has-commission { background: #fffbe6; }
tr.has-commission:hover { background: #fff5cc; }
tr.overdue { background: #fff5f5; }
tr.overdue:hover { background: #ffe8e8; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
/* Status badges */
.badge-pending { background: #fff3cd; color: #856404; }
.badge-processing { background: #cce5ff; color: #004085; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-failed { background: #f8d7da; color: #721c24; }
.badge-cancelled { background: #e9ecef; color: #6c757d; }
.badge-overdue { background: #f8d7da; color: #721c24; }
.badge-refunded { background: #e9ecef; color: #6c757d; }
.badge-none { background: #e9ecef; color: #6c757d; }

/* Agent badges */
.badge-active { background: #d4edda; color: #155724; }
.badge-suspended { background: #f8d7da; color: #721c24; }
.badge-bronze { background: #cd7f32; color: white; }
.badge-silver { background: #c0c0c0; color: #333; }
.badge-gold { background: #ffd700; color: #333; }
.badge-platinum { background: #e5e4e2; color: #333; }

/* KYC badges */
.badge-kyc-verified { background: #d4edda; color: #155724; }
.badge-kyc-pending { background: #fff3cd; color: #856404; }
.badge-kyc-not-started { background: #e9ecef; color: #6c757d; }

/* Commission badges */
.badge-comm-pending { background: #fff3cd; color: #856404; }
.badge-comm-approved { background: #d4edda; color: #155724; }
.badge-comm-paid { background: #cce5ff; color: #004085; }
.badge-comm-refunded { background: #f8d7da; color: #721c24; }

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3040d6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.spinner.orange { border-top-color: #fd7e14; }
.spinner.gray { border-top-color: #6c757d; }
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message */
.message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: none;
}
.message.success { background: #d4edda; color: #155724; display: block; }
.message.error { background: #f8d7da; color: #721c24; display: block; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
}
.pagination-info { color: #666; }
.pagination-buttons { display: flex; gap: 5px; }

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-weight: 500;
}
.tab.active {
    background: #3040d6;
    color: white;
    border-color: #3040d6;
}
.tab .count {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 5px;
}
.tab.active .count {
    background: rgba(255,255,255,0.3);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h2 { margin-bottom: 20px; }
.modal .form-group { margin-bottom: 15px; }
.modal label { display: block; margin-bottom: 5px; font-weight: 500; }
.modal input, .modal select, .modal textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.modal textarea { min-height: 100px; resize: vertical; }
.modal .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}
.modal .form-row {
    display: flex;
    gap: 15px;
}
.modal .form-row .form-group {
    flex: 1;
}

/* Editors Index Page */
.editors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.editor-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
}
.editor-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
.editor-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.editor-icon {
    width: 48px;
    height: 48px;
    background: #3040d6;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}
.editor-icon.green { background: #28a745; }
.editor-icon.orange { background: #fd7e14; }
.editor-icon.red { background: #dc3545; }
.editor-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}
.editor-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}
.editor-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 10px;
}
.badge-ready { background: #d4edda; color: #155724; }
.badge-wip { background: #fff3cd; color: #856404; }
.badge-todo { background: #f8d7da; color: #721c24; }

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 30px 0 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}
.section-title:first-of-type { margin-top: 0; }

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}
.breadcrumb-item {
    color: #3040d6;
    text-decoration: none;
}
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-item.current {
    color: #333;
    font-weight: 600;
    pointer-events: none;
}
.breadcrumb-sep { color: #aaa; }

/* Row highlight animation */
@keyframes highlightFade {
    0%   { background: #fff3cd; }
    100% { background: transparent; }
}
tr.highlight-row {
    animation: highlightFade 3s ease-out;
}

/* Clickable rows */
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #e8f0fe; }
td .nav-link {
    color: #3040d6;
    text-decoration: none;
    cursor: pointer;
}
td .nav-link:hover { text-decoration: underline; }

/* User Card sliding panel */
.user-card-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 2000;
}
.user-card-overlay.active { display: block; }

.user-card-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 480px;
    max-width: 100vw;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 2001;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    padding: 20px;
}
.user-card-overlay.active .user-card-panel {
    transform: translateX(0);
}

.user-card-panel .uc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}
.user-card-panel .uc-header h2 { margin: 0; font-size: 20px; }
.user-card-panel .uc-close {
    background: none; border: none; font-size: 24px;
    cursor: pointer; color: #999; padding: 4px 8px;
}
.user-card-panel .uc-close:hover { color: #333; }

.user-card-panel .uc-section {
    margin-bottom: 20px;
}
.user-card-panel .uc-section-title {
    font-size: 12px; font-weight: 600; color: #666;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 10px; padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}
.user-card-panel .uc-field {
    display: flex; justify-content: space-between;
    padding: 4px 0; font-size: 13px;
}
.user-card-panel .uc-field-label { color: #888; }
.user-card-panel .uc-field-value { font-weight: 500; color: #333; }

.user-card-panel .uc-mini-table {
    width: 100%; border-collapse: collapse;
    font-size: 12px; margin-top: 8px;
}
.user-card-panel .uc-mini-table th {
    background: #f8f9fa; color: #555;
    padding: 6px 8px; text-align: left;
    font-weight: 600; font-size: 11px;
    position: static;
}
.user-card-panel .uc-mini-table td {
    padding: 6px 8px; border-bottom: 1px solid #f0f0f0;
}
.user-card-panel .uc-mini-table th:hover { background: #f8f9fa; }

.user-card-panel .uc-actions {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.user-card-panel .uc-actions a {
    display: inline-block; padding: 6px 12px;
    background: #3040d6; color: white; border-radius: 4px;
    text-decoration: none; font-size: 12px;
}
.user-card-panel .uc-actions a:hover { background: #2535b8; }
.user-card-panel .uc-actions a.secondary {
    background: #6c757d;
}
.user-card-panel .uc-actions a.secondary:hover { background: #5a6268; }

/* Alerts inside user card */
.alert-warning {
    background: #fff3cd; color: #856404;
    padding: 8px 12px; border-radius: 4px;
    font-size: 12px; margin-bottom: 8px;
}
.alert-critical {
    background: #f8d7da; color: #721c24;
    padding: 8px 12px; border-radius: 4px;
    font-size: 12px; margin-bottom: 8px;
}
