/* HTFX Trading System - Dark Theme CSS */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0b0e11;
    color: #eaecef;
    overflow-x: hidden;
    line-height: 1.5;
}

.trading-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0b0e11 0%, #1a1d29 100%);
}

/* Header Styles */
.trading-header {
    background: rgba(11, 14, 17, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #2d3748;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.htfx-logo {
    height: 40px;
    width: auto;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4aa, #00b4d8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.user-id-display {
    font-size: 0.875rem;
    color: #a0aec0;
    font-weight: 500;
}

.balance-display {
    font-size: 1rem;
    color: #00d4aa;
    font-weight: 600;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #eaecef;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.login-btn {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: #00d4aa;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: rgba(0, 212, 170, 0.2);
    transform: translateY(-1px);
}

.history-btn {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.history-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    transform: translateY(-1px);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Coin Sidebar */
.coin-sidebar {
    background: rgba(26, 29, 41, 0.8);
    border-radius: 12px;
    border: 1px solid #2d3748;
    padding: 1rem;
    height: fit-content;
}

.sidebar-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #eaecef;
}

.coin-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.coin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.coin-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 212, 170, 0.3);
}

.coin-item.active {
    background: rgba(0, 212, 170, 0.1);
    border-color: #00d4aa;
}

.coin-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.coin-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.coin-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.coin-symbol {
    font-size: 0.875rem;
    font-weight: 600;
    color: #eaecef;
}

.coin-name {
    font-size: 0.75rem;
    color: #a0aec0;
}

.coin-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: #eaecef;
    text-align: right;
}

.coin-change {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: right;
    min-width: 60px;
}

.coin-change.positive {
    color: #00d4aa;
}

.coin-change.negative {
    color: #f56565;
}

/* Chart Section */
.chart-section {
    background: rgba(26, 29, 41, 0.8);
    border-radius: 12px;
    border: 1px solid #2d3748;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #2d3748;
}

.selected-coin-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selected-coin-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.selected-coin-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.selected-coin-symbol {
    font-size: 1.125rem;
    font-weight: 600;
    color: #eaecef;
}

.selected-coin-price {
    font-size: 0.875rem;
    color: #00d4aa;
    font-weight: 500;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a0aec0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.chart-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #eaecef;
}

.chart-btn.active {
    background: #00d4aa;
    border-color: #00d4aa;
    color: #0b0e11;
}

.chart-container {
    flex: 1;
    min-height: 400px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #a0aec0;
    font-size: 1rem;
}

/* Trading Panel */
.trading-panel {
    background: rgba(26, 29, 41, 0.8);
    border-radius: 12px;
    border: 1px solid #2d3748;
    padding: 1.5rem;
    height: fit-content;
}

.panel-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #eaecef;
}

/* Duration Section */
.duration-section {
    margin-bottom: 1.5rem;
}

.duration-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #a0aec0;
    margin-bottom: 0.75rem;
}

.duration-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.duration-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.duration-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 170, 0.3);
}

.duration-option.active {
    background: rgba(0, 212, 170, 0.1);
    border-color: #00d4aa;
}

.duration-time {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #eaecef;
    margin-bottom: 0.25rem;
}

.duration-profit {
    display: block;
    font-size: 0.75rem;
    color: #00d4aa;
    font-weight: 500;
}

/* Amount Section */
.amount-section {
    margin-bottom: 1.5rem;
}

.amount-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #a0aec0;
    margin-bottom: 0.75rem;
}

.amount-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#amount-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    color: #eaecef;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
}

#amount-input:focus {
    outline: none;
    border-color: #00d4aa;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.amount-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.amount-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a0aec0;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    font-weight: 500;
}

.amount-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #eaecef;
}

/* Trade Buttons */
.trade-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.trade-btn {
    flex: 1;
    padding: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.trade-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.trade-btn:hover::before {
    left: 100%;
}

.buy-btn {
    background: linear-gradient(135deg, #00d4aa, #00b4d8);
    color: #0b0e11;
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
}

.buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
}

.sell-btn {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

.sell-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 101, 101, 0.4);
}

/* Balance Info */
.balance-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.balance-item span:first-child {
    color: #a0aec0;
}

.balance-item span:last-child {
    color: #eaecef;
    font-weight: 500;
}

/* Bottom Section */
.bottom-section {
    background: rgba(26, 29, 41, 0.8);
    border-top: 1px solid #2d3748;
    margin-top: auto;
}

.section-tabs {
    display: flex;
    border-bottom: 1px solid #2d3748;
    padding: 0 2rem;
}

.tab-btn {
    background: none;
    border: none;
    color: #a0aec0;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: #eaecef;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #00d4aa;
    border-bottom-color: #00d4aa;
}

.tab-content {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #eaecef;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a0aec0;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #eaecef;
}

/* History Table - Enhanced Design */
.history-table {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.history-table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,212,170,0.5), transparent);
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
    font-weight: 600;
    color: #a0aec0;
}

.table-body {
    max-height: 300px;
    overflow-y: auto;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

.table-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.table-row:last-child {
    border-bottom: none;
}

.table-cell {
    font-size: 0.875rem;
    color: #eaecef;
    display: flex;
    align-items: center;
}

.table-cell.result-win {
    color: #00d4aa;
    font-weight: 600;
}

.table-cell.result-loss {
    color: #f56565;
    font-weight: 600;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #a0aec0;
    font-style: italic;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(26, 29, 41, 0.95);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #2d3748;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #eaecef;
}

.modal-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #eaecef;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Order Details */
.order-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.detail-row span:first-child {
    color: #a0aec0;
    font-weight: 500;
}

.detail-row span:last-child {
    color: #eaecef;
    font-weight: 600;
}

/* Process Modal */
.process-modal {
    text-align: center;
}

.process-details {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.process-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.countdown-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.countdown-circle {
    width: 120px;
    height: 120px;
    border: 4px solid #2d3748;
    border-top: 4px solid #00d4aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spin 1s linear infinite;
}

.countdown-text {
    font-size: 2rem;
    font-weight: 700;
    color: #00d4aa;
}

.countdown-label {
    color: #a0aec0;
    font-size: 0.875rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result Modal */
.result-modal {
    text-align: center;
}

.result-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.result-icon.win {
    color: #00d4aa;
}

.result-icon.loss {
    color: #f56565;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-coin {
    font-size: 1.25rem;
    font-weight: 600;
    color: #eaecef;
}

.result-type {
    font-size: 1rem;
    color: #a0aec0;
}

.result-amount {
    font-size: 1.125rem;
    color: #eaecef;
}

.result-profit {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-profit.win {
    color: #00d4aa;
}

.result-profit.loss {
    color: #f56565;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4aa, #00b4d8);
    color: #0b0e11;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a0aec0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #eaecef;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 250px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .coin-sidebar {
        order: 2;
    }
    
    .chart-section {
        order: 1;
    }
    
    .trading-panel {
        order: 3;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .trading-header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-info {
        align-items: flex-start;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .duration-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr 1fr 1fr;
        font-size: 0.75rem;
    }
    
    .table-header span:nth-child(n+4),
    .table-row .table-cell:nth-child(n+4) {
        display: none;
    }
}

@media (max-width: 480px) {
    .duration-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .amount-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trade-buttons {
        flex-direction: column;
    }
    
    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .countdown-circle {
        width: 100px;
        height: 100px;
    }
    
    .countdown-text {
        font-size: 1.5rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #00d4aa;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success/Error States */
.success {
    border-color: #00d4aa !important;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1) !important;
}

.error {
    border-color: #f56565 !important;
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1) !important;
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

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

/* Trading History Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1d29 0%, #2d3748 100%);
    margin: 2% auto;
    padding: 0;
    border: 1px solid #4a5568;
    border-radius: 16px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: rgba(0, 212, 170, 0.1);
    border-bottom: 1px solid #4a5568;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #00d4aa;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #eaecef;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.modal-body {
    padding: 2rem;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.refresh-btn {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: #00d4aa;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.refresh-btn:hover {
    background: rgba(0, 212, 170, 0.2);
    transform: translateY(-1px);
}

.history-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #a0aec0;
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #eaecef;
}

.stat-value.win {
    color: #00d4aa;
}

.stat-value.loss {
    color: #ff6b6b;
}

.history-table-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #4a5568;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.history-table th {
    background: rgba(0, 212, 170, 0.15);
    color: #00d4aa;
    padding: 1.2rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.history-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,212,170,0.6), transparent);
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.history-table tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* P&L Colors */
.pnl-positive {
    color: #00d4aa !important;
    font-weight: 600;
}

.pnl-negative {
    color: #ff6b6b !important;
    font-weight: 600;
}

.pnl-zero {
    color: #a0aec0 !important;
}

/* Result Colors */
.result-win {
    color: #00d4aa !important;
    font-weight: 600;
}

.result-lose {
    color: #ff6b6b !important;
    font-weight: 600;
}

.result-pending {
    color: #fbbf24 !important;
    font-weight: 600;
}

/* Status Colors */
.status-completed {
    color: #00d4aa !important;
    font-weight: 600;
}

.status-pending {
    color: #fbbf24 !important;
    font-weight: 600;
}

/* Trade Row Styling */
.trade-row {
    transition: all 0.3s ease;
}

.trade-row:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-1px);
}

/* Mobile Optimizations - Enhanced */
@media (max-width: 768px) {
    .history-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        margin: 0 -10px;
    }
    
    .history-table {
        min-width: 900px;
        font-size: 0.8rem;
        border-radius: 12px;
    }
    
    .history-table th {
        padding: 1rem 0.8rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .history-table td {
        padding: 0.8rem;
        white-space: nowrap;
    }
    
    /* Hide less important columns on mobile */
    .trade-duration,
    .trade-status {
        display: none;
    }
    
    /* Make important columns more prominent */
    .trade-pnl {
        font-size: 1.1rem;
        font-weight: 700;
        text-align: center;
    }
    
    .trade-result {
        font-size: 1rem;
        font-weight: 700;
        text-align: center;
    }
    
    .trade-amount {
        font-weight: 600;
        font-size: 1rem;
    }
    
    .trade-id {
        font-weight: 600;
        color: #00d4aa;
    }
    
    .trade-pair {
        font-weight: 600;
        color: #ffffff;
    }
    
    .trade-date {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.7);
    }
}

@media (max-width: 480px) {
    .history-table {
        min-width: 700px;
        font-size: 0.75rem;
    }
    
    .history-table th {
        padding: 0.8rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .history-table td {
        padding: 0.6rem 0.4rem;
    }
    
    /* Hide more columns on very small screens */
    .trade-price {
        display: none;
    }
    
    /* Keep date but make it smaller */
    .trade-date {
        font-size: 0.7rem;
        color: rgba(255, 255, 255, 0.6);
    }
    
    /* Make P&L and result more prominent */
    .trade-pnl {
        font-size: 1.2rem;
        font-weight: 700;
        text-align: center;
    }
    
    .trade-result {
        font-size: 1.1rem;
        font-weight: 700;
        text-align: center;
    }
    
    .trade-id {
        font-size: 0.8rem;
        font-weight: 700;
        color: #00d4aa;
    }
    
    .trade-pair {
        font-size: 0.9rem;
        font-weight: 600;
        color: #ffffff;
    }
    
    .trade-amount {
        font-size: 0.9rem;
        font-weight: 600;
    }
}

.loading-row {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 2rem;
}

.result-win {
    color: #00d4aa;
    font-weight: 600;
}

.result-lose {
    color: #ff6b6b;
    font-weight: 600;
}

.result-pending {
    color: #ffc107;
    font-weight: 600;
}

.status-completed {
    color: #00d4aa;
}

.status-pending {
    color: #ffc107;
}

.pnl-positive {
    color: #00d4aa;
    font-weight: 600;
}

.pnl-negative {
    color: #ff6b6b;
    font-weight: 600;
}

.pnl-zero {
    color: #a0aec0;
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 1% auto;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .history-stats {
        justify-content: center;
        gap: 1rem;
    }
    
    .history-table {
        font-size: 0.75rem;
    }
    
    .history-table th,
    .history-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Compact Modal Styles */
.compact-modal {
    max-width: 420px !important;
    width: 90% !important;
    margin: 5% auto !important;
}

.compact-modal .modal-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1a1a2e 100%);
    border-bottom: 1px solid #334155;
}

.compact-modal .modal-header h2 {
    font-size: 1.2rem;
    color: #f1f5f9;
}

.compact-modal .modal-body {
    padding: 1rem 1.5rem;
    background: #0f172a;
    max-height: calc(90vh - 100px);
}

/* Compact Stats */
.history-stats-compact {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #334155;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-item.pnl-item {
    flex: 1;
}

.stat-label {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-value {
    color: #f1f5f9;
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-value.win {
    color: #10b981;
}

.stat-value.loss {
    color: #ef4444;
}

.refresh-btn-compact {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: #00d4aa;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn-compact:hover {
    background: rgba(0, 212, 170, 0.2);
    transform: translateY(-1px);
}

/* History List Container */
.history-list-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Trade Cards */
.trade-card {
    background: #1a1a2e;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.trade-card:hover {
    border-color: #00d4aa;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.1);
}

.trade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d4aa, #00b894);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.trade-card:hover::before {
    opacity: 1;
}

.trade-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.trade-id {
    color: #00d4aa;
    font-weight: 700;
    font-size: 0.9rem;
}

.trade-date {
    color: #94a3b8;
    font-size: 0.8rem;
}

.trade-main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.trade-pair {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 1rem;
}

.trade-type {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.trade-type.buy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.trade-type.sell {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.trade-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.trade-duration {
    color: #94a3b8;
}

.trade-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-icon {
    font-size: 1rem;
}

.result-icon.win {
    color: #10b981;
}

.result-icon.loss {
    color: #ef4444;
}

.trade-pnl {
    font-weight: 600;
    font-size: 0.9rem;
}

.trade-pnl.positive {
    color: #10b981;
}

.trade-pnl.negative {
    color: #ef4444;
}

.trade-status {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.trade-status.completed {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.trade-status.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Loading Card */
.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #94a3b8;
    gap: 1rem;
}

.loading-card i {
    font-size: 1.5rem;
    color: #00d4aa;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #94a3b8;
    gap: 1rem;
}

.empty-state i {
    font-size: 2rem;
    color: #64748b;
}

.empty-state p {
    text-align: center;
    font-size: 0.9rem;
}

/* Mobile Responsiveness for Compact Modal */
@media (max-width: 480px) {
    .compact-modal {
        width: 95% !important;
        margin: 2% auto !important;
        max-width: 380px !important;
    }
    
    .compact-modal .modal-body {
        padding: 0.75rem 1rem;
    }
    
    .trade-card {
        padding: 0.75rem;
    }
    
    .trade-main-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .trade-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
