:root {
    /* Color Palette - Premium Dark Theme */
    --bg-main: #0B0F19; /* Very deep blue/black */
    --bg-glass: rgba(26, 32, 44, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Accents */
    --primary: #3b82f6; /* Modern Blue */
    --primary-hover: #2563eb;
    --success: #10b981; /* Emerald Green */
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444; /* Red */
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b; /* Amber */
    --purple: #8b5cf6;
    
    /* UI Elements */
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4 { font-weight: 600; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input { font-family: inherit; }

/* Utilities */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.bg-success { background-color: var(--success-bg); }
.bg-danger { background-color: var(--danger-bg); }

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Views */
.view { display: none; opacity: 0; transition: opacity 0.4s ease; }
.view.active { display: flex; opacity: 1; min-height: 100vh; }

/* Auth Container */
#auth-view {
    align-items: center;
    justify-content: center;
}
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}
.auth-container .logo { font-size: 2rem; margin-bottom: 10px; color: var(--primary); display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-container h2 { color: var(--text-primary); }
.auth-container .subtitle { color: var(--text-secondary); margin-bottom: 30px; }

/* Form Elements */
form { display: flex; flex-direction: column; gap: 20px; }
.form-group { text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-secondary); }
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-group i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
}
.input-group input {
    width: 100%;
    padding: 14px 14px 14px 45px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}
.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}
.btn-block { width: 100%; }
.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-primary);
    border-radius: 50%;
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 10px 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-glass);
}
.divider span {
    padding: 0 10px;
}

/* Dashboard Layout */
#dashboard-view {
    display: flex;
    overflow: hidden;
}
.sidebar {
    width: 260px;
    margin: 20px;
    display: flex;
    flex-direction: column;
}
.sidebar .logo {
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}
.sidebar .logo h2 { color: var(--text-primary); }
.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    gap: 5px;
}
.nav-item {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}
.nav-item i { font-size: 1.2rem; width: 24px; text-align: center; }
.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}
.sidebar-bottom {
    padding: 20px;
    border-top: 1px solid var(--border-glass);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    overflow: hidden;
}
.avatar {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
#user-display {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    flex: 1;
    padding: 20px 40px 20px 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    margin-top: 20px;
}
.date-display {
    color: var(--text-secondary);
    margin-top: 5px;
}

.dashboard-scroll {
    overflow-y: auto;
    padding-right: 10px;
    padding-bottom: 40px;
    /* Custom Scrollbar */
}
.dashboard-scroll::-webkit-scrollbar { width: 8px; }
.dashboard-scroll::-webkit-scrollbar-track { background: transparent; }
.dashboard-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

/* Live Ticker */
.live-ticker {
    display: flex;
    gap: 30px;
    padding: 15px 24px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    align-items: center;
}
.ticker-item span {
    font-weight: 700;
    margin-left: 5px;
    color: var(--text-primary);
    font-family: monospace;
}
.ticker-item.up span { color: var(--success); }
.ticker-item.down span { color: var(--danger); }

/* Tabs */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Table */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}
.trade-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.trade-table th, .trade-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-glass);
}
.trade-table th {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
}
.trade-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.img-thumb {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-glass);
    transition: var(--transition);
}
.img-thumb:hover { border-color: var(--primary); transform: scale(1.1); }
.action-icons { display: flex; gap: 10px; }
.action-icons i { cursor: pointer; color: var(--text-secondary); transition: var(--transition); }
.action-icons i:hover { color: var(--text-primary); }
.action-icons i.fa-trash:hover { color: var(--danger); }

/* Summary Cards (Added Warning Color) */
.card-icon.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}
.card:hover { transform: translateY(-5px); }
.card-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.card-icon.blue { background: rgba(59, 130, 246, 0.2); color: var(--primary); }
.card-icon.green { background: var(--success-bg); color: var(--success); }
.card-icon.purple { background: rgba(139, 92, 246, 0.2); color: var(--purple); }
.card-icon.red { background: var(--danger-bg); color: var(--danger); }
.card-info p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 5px; }
.card-info h3 { font-size: 1.5rem; }

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.chart-section {
    padding: 24px;
}
.chart-container {
    height: 300px;
    width: 100%;
}

/* Calendar */
.calendar-section {
    padding: 24px;
}
.calendar-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
}
.calendar-grid {
    display: flex;
    flex-direction: column;
}
.cal-header, .cal-cell {
    display: flex;
    justify-content: center;
}
.calendar-grid > div:first-child { /* Headers container */
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    text-align: center;
}
.cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}
.cal-cell {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.cal-cell:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}
.cal-cell.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}
.cal-date {
    font-weight: 500;
    font-size: 0.9rem;
}
.cal-pnl {
    align-self: center;
    font-weight: 600;
    font-size: 1.1rem;
}
.cal-cell.profit { border-color: var(--success); box-shadow: 0 0 15px rgba(16, 185, 129, 0.1) inset; }
.cal-cell.profit .cal-pnl { color: var(--success); }
.cal-cell.loss { border-color: var(--danger); box-shadow: 0 0 15px rgba(239, 68, 68, 0.1) inset; }
.cal-cell.loss .cal-pnl { color: var(--danger); }
.cal-cell.zero { border-color: var(--text-secondary); }
.cal-cell.zero .cal-pnl { color: var(--text-secondary); }

.cal-cell.today {
    background: rgba(59, 130, 246, 0.1);
}
.cal-cell.today .cal-date {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.modal {
    width: 100%;
    max-width: 450px;
    padding: 30px;
    transform: translateY(20px);
    transition: var(--transition);
}
.modal-overlay.active .modal {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.btn-close {
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
}
.btn-close:hover { color: var(--text-primary); }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

.share-content { text-align: center; }
.share-content p { color: var(--text-secondary); margin-bottom: 20px; }
.link-box {
    display: flex;
    gap: 10px;
}
.link-box input {
    flex: 1;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-family: monospace;
}

/* Responsive */
@media (max-width: 1200px) {
    .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 992px) {
    #dashboard-view { flex-direction: column; }
    .sidebar { width: auto; margin: 10px; flex-direction: row; align-items: center; padding: 10px 20px; }
    .sidebar .logo { padding: 0; }
    .nav-menu { flex-direction: row; margin-left: 20px; }
    .sidebar-bottom { border-top: none; padding: 0; margin-left: auto; display: flex; align-items: center; }
    .user-info { margin-bottom: 0; margin-right: 20px; }
    .main-content { padding: 10px; height: auto; }
}
@media (max-width: 768px) {
    .cal-body { gap: 5px; }
    .cal-cell { padding: 5px; }
    .cal-pnl { font-size: 0.9rem; }
}
