/* Trading Simulator Dashboard Styles */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    margin: 0;
    padding: 0;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
}

.sidebar-footer {
    padding: 14px 14px 18px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-footer-btn:hover {
    background: rgba(255, 255, 255, 0.10);
}

.mysql-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 6px 0 6px;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.75);
}

.mysql-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.mysql-dot-ok {
    background: var(--success-color);
}

.mysql-dot-bad {
    background: var(--danger-color);
}

.mysql-dot-unknown {
    background: rgba(255, 255, 255, 0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-icon {
    font-size: 1.3rem;
    margin-right: 12px;
    min-width: 24px;
}

.nav-text {
    font-weight: 500;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 250px;
    width: calc(100% - 250px);
    min-height: 100vh;
    background: var(--background);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Page Views */
.page-view {
    animation: fadeIn 0.3s ease;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Main Content */
.main-content {
    display: grid;
    gap: 24px;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 30px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-secondary {
    background: var(--secondary-color);
}

/* Form */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
}

.label-text {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.label-hint {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="month"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Country Distribution */
.country-distribution {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.country-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.country-flag {
    font-weight: 600;
    min-width: 40px;
    padding: 8px 12px;
    background: var(--background);
    border-radius: 6px;
    text-align: center;
}

.country-input {
    flex: 1;
    max-width: 100px;
}

.country-percent {
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--danger-color);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #dc2626;
}

.country-total {
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 12px;
}

.warning {
    color: var(--danger-color);
    margin-left: 12px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-icon {
    font-size: 1.2rem;
}

.form-actions {
    margin-top: 32px;
}

/* Progress */
.progress-container {
    margin-top: 24px;
    padding: 20px;
    background: var(--background);
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    transition: width 0.3s ease;
    border-radius: 12px;
}

.progress-text {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Results */
.results {
    margin-top: 24px;
    padding: 20px;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

.results.error {
    border-left-color: var(--danger-color);
}

.results h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.result-item {
    padding: 12px;
    background: white;
    border-radius: 6px;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.coming-soon p {
    margin-bottom: 8px;
}

.hint {
    font-size: 0.875rem;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    text-align: center;
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.country-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.country-stat {
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
    text-align: center;
}

.country-stat-code {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.country-stat-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Footer */
.footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.75rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .country-row {
        flex-wrap: wrap;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px 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); }
}

/* ============================================
   USERS PAGE STYLES
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 0;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Filters */
.filters-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group select {
    min-width: 150px;
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

.bulk-actions span {
    font-weight: 600;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Data Table */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: var(--background);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--background);
}

.data-table tbody tr.selected {
    background: rgba(59, 130, 246, 0.1);
}

.text-center {
    text-align: center;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.status-inactive {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

/* Action Buttons */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 4px;
}

.action-btn-edit {
    background: var(--primary-color);
    color: white;
}

.action-btn-edit:hover {
    background: var(--primary-hover);
}

.action-btn-delete {
    background: var(--danger-color);
    color: white;
}

.action-btn-delete:hover {
    background: #dc2626;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 20px 0;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-large .modal-content {
    max-width: 800px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Preview Content */
.preview-stats {
    background: var(--background);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.preview-stats h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.preview-stat-card {
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border-color);
}

.preview-stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.preview-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.preview-country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.preview-country-card {
    padding: 16px;
    background: white;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border-color);
}

.preview-country-code {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.preview-country-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.preview-sample {
    margin-top: 24px;
}

.preview-sample h4 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.preview-sample-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.preview-sample-table th,
.preview-sample-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.preview-sample-table th {
    background: var(--background);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h2 {
        font-size: 1.5rem;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-icon {
        margin-right: 0;
    }
    
    .main-wrapper {
        margin-left: 60px;
        width: calc(100% - 60px);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .filters-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select {
        flex: 1;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
}
