:root {
    --bg-color: #f1f5f9;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #e0e7ff 0%, #f1f5f9 100%);
    color: var(--text-dark);
    min-height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    box-shadow: var(--glass-shadow);
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.logo-area i {
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: var(--text-light);
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item i {
    width: 20px;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info {
    display: flex;
    flex-direction: column;
}

.name {
    font-weight: 600;
    font-size: 0.95rem;
}

.level {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 2rem 3rem;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.top-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.subtitle {
    color: var(--text-light);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.notification-btn {
    background: white;
    position: relative;
    padding: 0.8rem;
    color: var(--text-light);
}

.notification-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    animation: pulse 2s infinite;
}

.cta-btn, .primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cta-btn:hover, .primary-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.secondary-btn {
    background: white;
    color: var(--text-dark);
    border: 1px solid #e2e8f0;
}

.secondary-btn:hover:not([disabled]) {
    background: #f8fafc;
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    transition: transform 0.3s;
}

.glass:hover {
    transform: translateY(-2px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-details h3 {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.trend {
    font-size: 0.85rem;
    font-weight: 600;
}

.trend.up { color: var(--success); }

/* Activity List */
.recent-activity h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.activity-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.act-icon {
    width: 40px;
    height: 40px;
    background: #e0f2fe;
    color: #0ea5e9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.act-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.act-info p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.act-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Page Sections */
.page-section {
    animation: fadeIn 0.4s ease forwards;
}

.hidden {
    display: none !important;
}

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

/* Markets Grid */
.section-header {
    margin-bottom: 2rem;
}

.markets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.market-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.market-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.market-logo {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid #e2e8f0;
}

.market-info h4 {
    font-size: 1.1rem;
}

.market-info p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.market-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* PlayAuto Section */
.pa-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.disconnected { background: #fee2e2; color: #ef4444; }
.status-badge.connected { background: #d1fae5; color: #10b981; }

.pa-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.pa-console {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    color: #38bdf8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    height: 300px;
    display: flex;
    flex-direction: column;
}

.console-header {
    background: #1e293b;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.dots { display: flex; gap: 6px; }
.dots span { width: 12px; height: 12px; border-radius: 50%; }
.dots .r { background: #ef4444; }
.dots .y { background: #f59e0b; }
.dots .g { background: #10b981; }

.console-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
}

.log-line {
    margin-bottom: 5px;
}
.log-success { color: #4ade80; }
.log-error { color: #f87171; }
.log-warning { color: #fbbf24; }

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    font-weight: 600;
    color: var(--text-light);
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge.excel { background: #dcfce7; color: #15803d; }
.badge.zip { background: #fee2e2; color: #b91c1c; }

.status-badge.ready { background: #e0f2fe; color: #0284c7; }
.status-badge.processing { background: #fef08a; color: #854d0e; }
.status-badge.completed { background: #dcfce7; color: #15803d; }

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.action-btn:hover {
    background: #e2e8f0;
}
.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
