/* ============================================
   PRO TRADE JOURNAL - MAIN STYLESHEET
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #131722;
    color: #d1d4dc;
    overflow-x: hidden;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.header {
    background: #1e222d;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2e39;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo h1 {
    font-size: 22px;
    background: linear-gradient(135deg, #2962ff, #00e5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #131722;
    padding: 8px 20px;
    border-radius: 25px;
}

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

.balance-label {
    font-size: 11px;
    color: #787b86;
}

.balance-value {
    font-size: 18px;
    font-weight: bold;
}

.positive {
    color: #00e5ff;
}

.negative {
    color: #f23645;
}

.logout-btn {
    background: #f23645;
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #d41f2e;
    transform: translateY(-2px);
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.main-container {
    display: flex;
    height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #1e222d;
    border-right: 1px solid #2a2e39;
    overflow-y: auto;
    padding: 20px;
}

.category {
    margin-bottom: 25px;
}

.category-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #787b86;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.symbol-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.symbol-item {
    padding: 10px 12px;
    background: #131722;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.symbol-item:hover {
    background: #2a2e39;
    transform: translateX(5px);
}

.symbol-item.active {
    background: #2962ff;
    color: white;
}

.symbol-name {
    font-weight: 600;
}

.symbol-price {
    font-size: 12px;
    color: #787b86;
}

/* Chart Area */
.chart-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #131722;
}

.chart-toolbar {
    background: #1e222d;
    padding: 10px 20px;
    border-bottom: 1px solid #2a2e39;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.timeframe-btn {
    background: #131722;
    border: 1px solid #2a2e39;
    color: #d1d4dc;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.timeframe-btn:hover {
    background: #2a2e39;
}

.timeframe-btn.active {
    background: #2962ff;
    border-color: #2962ff;
}

#tradingview-chart {
    flex: 1;
    min-height: 500px;
}

/* Order Panel */
.order-panel {
    width: 380px;
    background: #1e222d;
    border-left: 1px solid #2a2e39;
    overflow-y: auto;
    padding: 20px;
}

.trade-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-buy {
    background: #00e5ff;
    color: #131722;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-sell {
    background: #f23645;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-buy:hover, .btn-sell:hover {
    transform: scale(1.02);
}

.btn-buy.active {
    background: #00c4e0;
    box-shadow: 0 0 10px rgba(0,229,255,0.5);
}

.btn-sell.active {
    background: #d41f2e;
    box-shadow: 0 0 10px rgba(242,54,69,0.5);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: #787b86;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: #131722;
    border: 1px solid #2a2e39;
    border-radius: 8px;
    color: #d1d4dc;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #2962ff;
}

.risk-display {
    background: #131722;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 12px;
}

.btn-order {
    width: 100%;
    background: linear-gradient(135deg, #2962ff, #00e5ff);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s;
}

.btn-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(41,98,255,0.4);
}

.market-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #2a2e39;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
}

/* Sections */
.positions-section,
.history-section,
.calendar-section {
    background: #1e222d;
    margin: 20px;
    border-radius: 12px;
    padding: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    color: #00e5ff;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #2a2e39;
}

th {
    color: #787b86;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: rgba(42,46,57,0.5);
}

.long {
    color: #00e5ff;
    font-weight: bold;
}

.short {
    color: #f23645;
    font-weight: bold;
}

.close-btn {
    background: #f23645;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #d41f2e;
}

.export-btn {
    background: #2962ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.export-btn:hover {
    background: #1a4fcc;
    transform: translateY(-1px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1e222d;
    border-radius: 16px;
    padding: 30px;
    width: 400px;
    text-align: center;
    border: 1px solid #2a2e39;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #00e5ff;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn-confirm {
    background: #00e5ff;
    color: #131722;
    border: none;
    padding: 10px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.btn-cancel {
    background: #2a2e39;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 8px;
    cursor: pointer;
}

/* Login & Register Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 450px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

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

.auth-footer {
    text-align: center;
    margin-top: 20px;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}
.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        display: none;
    }
    .order-panel {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    .user-menu {
        width: 100%;
        justify-content: space-between;
    }
    .main-container {
        flex-direction: column;
        height: auto;
    }
    .order-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #2a2e39;
    }
    .chart-toolbar {
        overflow-x: auto;
    }
}

/* Fullscreen Chart */
.chart-container {
    position: relative;
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: #2962ff;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.fullscreen-btn:hover {
    background: #1a4fcc;
}

.chart-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: #131722 !important;
}

/* Backtest Panel */
.backtest-panel {
    background: #1e222d;
    border-radius: 12px;
    padding: 20px;
    margin: 20px;
}

.backtest-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.backtest-btn {
    background: #2962ff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.backtest-btn:hover {
    background: #1a4fcc;
}

.playback-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
    padding: 15px;
    background: #131722;
    border-radius: 8px;
}

.playback-btn {
    background: #2a2e39;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.playback-btn.active {
    background: #00e5ff;
    color: #131722;
}

.backtest-results {
    margin-top: 20px;
    padding: 15px;
    background: #131722;
    border-radius: 8px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-box {
    text-align: center;
    padding: 10px;
    background: #1e222d;
    border-radius: 8px;
}