/**
 * Trading Log Modal Styles
 * Professional, sleek design matching dashboard theme
 */

/* Modal Overlay */
.trading-log-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.trading-log-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Modal Content */
.trading-log-modal-content {
    position: relative;
    background: white;
    width: 95%;
    max-width: 1400px;
    height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header */
.trading-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 3px solid #5568d3;
}

.trading-log-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trading-log-icon {
    font-size: 28px;
}

.trading-log-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.trading-log-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin-left: 8px;
}

.trading-log-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 32px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.trading-log-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Toolbar */
.trading-log-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.trading-log-stats {
    display: flex;
    gap: 24px;
}

.trading-log-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.stat-label {
    color: #666;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 16px;
    color: #333;
}

.stat-value.positive {
    color: #10b981;
}

.stat-value.negative {
    color: #ef4444;
}

.trading-log-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.trading-log-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.trading-log-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.trading-log-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trading-log-btn.download {
    background: #10b981;
    color: white;
}

.trading-log-btn.download:hover {
    background: #059669;
    transform: translateY(-1px);
}

.trading-log-btn.refresh {
    background: #3b82f6;
    color: white;
}

.trading-log-btn.refresh:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.trading-log-btn.clear-all {
    background: #ef4444;
    color: white;
}

.trading-log-btn.clear-all:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Table Container */
.trading-log-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0;
    position: relative;
}

.trading-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.trading-log-table thead {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.trading-log-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #e0e0e0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trading-log-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

/* Row Grouping */
.trading-log-table .even-group {
    background: #ffffff;
}

.trading-log-table .odd-group {
    background: #f9fafb;
}

.trading-log-table .position-row:hover {
    background: #f0f4ff !important;
}

.trading-log-table .total-row {
    border-bottom: 2px solid #d0d0d0 !important;
}

.trading-log-table .deleted-row {
    opacity: 0.5;
    background: #fef2f2 !important;
}

/* Cell Styles */
.center-text {
    text-align: center;
}

.bold {
    font-weight: 700;
}

.leg-cell {
    font-weight: 600;
    font-size: 12px;
}

.ce-leg {
    color: #dc2626;
}

.pe-leg {
    color: #16a34a;
}

.total-leg {
    color: #6366f1;
}

.editable-cell {
    cursor: pointer;
    background: #f0f9ff;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.editable-cell:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.tlog-edit-input {
    width: 100%;
    padding: 6px;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.pnl-cell {
    font-weight: 600;
    text-align: right;
}

.pnl-cell.positive {
    color: #10b981;
}

.pnl-cell.negative {
    color: #ef4444;
}

.points-cell {
    text-align: right;
    font-weight: 500;
}

.points-cell.positive {
    color: #10b981;
}

.points-cell.negative {
    color: #ef4444;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.deleted {
    background: #fee2e2;
    color: #991b1b;
}

/* Actions Cell */
.actions-cell {
    text-align: center;
    white-space: nowrap;
}

.tlog-action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 2px;
}

.tlog-action-btn.delete {
    background: #fee2e2;
    color: #991b1b;
}

.tlog-action-btn.delete:hover {
    background: #fecaca;
    transform: scale(1.1);
}

.tlog-action-btn.restore {
    background: #dbeafe;
    color: #1e40af;
}

.tlog-action-btn.restore:hover {
    background: #bfdbfe;
    transform: scale(1.1);
}

.tlog-action-btn.permanent-delete {
    background: #fecaca;
    color: #7f1d1d;
}

.tlog-action-btn.permanent-delete:hover {
    background: #f87171;
    color: white;
    transform: scale(1.1);
}

/* Empty State */
.trading-log-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    font-weight: 500;
}

/* Loading State */
.trading-log-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}

/* Header Actions Wrapper */
.pnl-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .trading-log-modal-content {
        width: 98%;
        height: 90vh;
    }
    
    .trading-log-table {
        font-size: 12px;
    }
    
    .trading-log-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .trading-log-header {
        padding: 16px;
    }
    
    .trading-log-title h2 {
        font-size: 20px;
    }
    
    .trading-log-subtitle {
        display: none;
    }
    
    .trading-log-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .trading-log-table-container {
        padding: 12px;
    }
}
