/**
 * OlympusTrade Unified Theme
 * Shared styles for all custom pages
 * v1.0 - December 2025
 */

/* CSS Variables */
:root {
    --primary: #0089a1;
    --primary-dark: #006c80;
    --primary-light: #00c3e6;
    --secondary: #667eea;
    --dark-bg: #0a0e27;
    --dark-card: #1a1f3a;
    --dark-border: rgba(255, 255, 255, 0.1);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-primary: var(--primary);
}

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

/* Base Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-card) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 80px; /* Space for sidebar toggle */
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Custom Sidebar Navigation */
.olympus-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: linear-gradient(180deg, #1a1f3a 0%, #0f1429 100%);
    border-right: 1px solid var(--dark-border);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    transform: translateX(-280px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.olympus-sidebar.open {
    transform: translateX(0);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10001;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--dark-bg);
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 20px rgba(0, 137, 161, 0.3);
    transition: all 0.3s;
    font-family: inherit;
}

.sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 137, 161, 0.5);
}

/* Sidebar Header */
.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid var(--dark-border);
    background: rgba(0, 137, 161, 0.05);
}

.sidebar-logo {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.sidebar-subtitle {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

/* Status Indicator */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 0 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 15px;
    font-weight: 500;
}

.nav-link-custom:hover {
    background: rgba(0, 137, 161, 0.08);
    border-left-color: var(--sidebar-primary);
    color: var(--sidebar-primary);
}

.nav-link-custom.active {
    background: rgba(0, 137, 161, 0.12);
    border-left-color: var(--sidebar-primary);
    color: var(--sidebar-primary);
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(0, 137, 161, 0.2);
    color: var(--sidebar-primary);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--dark-border);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Theme Buttons */
.theme-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
}

.theme-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: #fff;
    transform: scale(1.15);
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--secondary) 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    opacity: 0.9;
    font-size: 14px;
}

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

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.card-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--dark-border);
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.stat-card h3 {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--dark-bg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 137, 161, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success, .badge-long {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-danger, .badge-short {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-warning, .badge-hold {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--dark-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--dark-border);
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Forms */
input, select, textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 137, 161, 0.2);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .olympus-sidebar {
        width: 100%;
        transform: translateX(-100%);
    }

    .page-header {
        flex-direction: column;
        text-align: center;
    }

    .page-header h1 {
        font-size: 22px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--dark-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Utility Classes */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toasts/Notifications */
.toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
