/**
 * R-Multiple Tracker Admin Styles
 * Brand Colors: #000000 #0cbb75 #ffffff
 */

/* ==========================================================================
   Global Styles
   ========================================================================== */

:root {
    --rmt-primary: #0cbb75;
    --rmt-black: #000000;
    --rmt-white: #ffffff;
    --rmt-success: #0cbb75;
    --rmt-danger: #dc3545;
    --rmt-warning: #ffc107;
    --rmt-info: #0073aa;
    --rmt-gray-50: #f9f9f9;
    --rmt-gray-100: #f0f0f1;
    --rmt-gray-200: #ddd;
    --rmt-gray-600: #666;
    --rmt-gray-800: #333;
}

.rmt-dashboard,
.rmt-trade-log {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Frontend-specific styles */
.rmt-frontend {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.rmt-frontend .rmt-page-title {
    background: var(--rmt-white);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Dashboard Stats Grid - 4 Column Horizontal Layout
   ========================================================================== */

.rmt-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.rmt-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid var(--rmt-primary);
    min-height: 120px;
    width: 100%;
}

.rmt-card-positive {
    border-left-color: var(--rmt-success);
}

.rmt-card-negative {
    border-left-color: var(--rmt-danger);
}

.rmt-card-total {
    border-left-color: var(--rmt-black);
}

.rmt-card-expectancy {
    border-left-color: var(--rmt-primary);
}

.rmt-card-expectancy.rmt-expectancy-positive {
    border-left-color: var(--rmt-success);
}

.rmt-card-expectancy.rmt-expectancy-negative {
    border-left-color: var(--rmt-danger);
}

.rmt-stat-icon {
    font-size: 42px;
    opacity: 0.8;
    flex-shrink: 0;
}

.rmt-stat-content {
    flex: 1;
    min-width: 0;
}

.rmt-stat-content h3 {
    margin: 0 0 8px 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rmt-gray-600);
    font-weight: 600;
}

.rmt-stat-value {
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 5px;
}

.rmt-stat-meta {
    font-size: 12px;
    color: var(--rmt-gray-600);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.rmt-dashboard .button-primary,
.rmt-trade-log .button-primary,
#tradeForm .button-primary {
    background-color: var(--rmt-primary) !important;
    border-color: var(--rmt-primary) !important;
    color: var(--rmt-white) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    transition: all 0.2s ease;
}

.rmt-dashboard .button-primary:hover,
.rmt-trade-log .button-primary:hover,
#tradeForm .button-primary:hover {
    background-color: #0aa565 !important;
    border-color: #0aa565 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.rmt-dashboard .button-primary:active,
.rmt-trade-log .button-primary:active,
#tradeForm .button-primary:active {
    transform: translateY(0);
}

.button .dashicons {
    vertical-align: middle;
    margin-top: -2px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.rmt-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.rmt-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--rmt-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: rmt-spin 0.6s linear infinite;
}

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

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Keep 3 columns on desktop and larger tablets */
@media screen and (min-width: 1025px) {
    .rmt-stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (max-width: 1200px) {
    .rmt-trade-table .rmt-col-risk,
    .rmt-trade-table .rmt-col-pnl {
        display: none;
    }
}

/* Stack stats on tablets and mobile */
@media screen and (max-width: 1024px) {
    .rmt-stats-grid {
        grid-template-columns: 1fr !important;
    }
}

@media screen and (max-width: 782px) {
    .rmt-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rmt-form-row {
        grid-template-columns: 1fr;
    }
    
    .rmt-actions-bar {
        flex-direction: column;
    }
    
    .rmt-trade-table {
        font-size: 12px;
    }
    
    .rmt-trade-table thead th,
    .rmt-trade-table tbody td {
        padding: 8px 5px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .rmt-actions-bar,
    .rmt-filter-bar,
    .rmt-quick-actions,
    .rmt-col-actions {
        display: none !important;
    }
    
    .rmt-trade-table {
        border: 1px solid #000;
    }
    
    .rmt-stat-card {
        break-inside: avoid;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.rmt-icon-btn:focus,
.rmt-modal-close:focus {
    outline: 2px solid var(--rmt-primary);
    outline-offset: 2px;
}

.rmt-form-group input:focus,
.rmt-form-group select:focus {
    outline: none;
    border-color: var(--rmt-primary);
    box-shadow: 0 0 0 3px rgba(12, 187, 117, 0.1);
}

/* Screen reader only text */
.rmt-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   Tooltips
   ========================================================================== */

.rmt-tooltip {
    position: relative;
    cursor: help;
}

.rmt-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--rmt-black);
    color: var(--rmt-white);
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.rmt-tooltip:hover::after {
    opacity: 1;
}

/* ==========================================================================
   Status Indicators
   ========================================================================== */

.rmt-status-open {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--rmt-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.rmt-status-closed {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--rmt-gray-600);
    border-radius: 50%;
}

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

/* ==========================================================================
   Data Tables Enhancements
   ========================================================================== */

.rmt-trade-table tbody tr {
    transition: background-color 0.2s;
}

.rmt-trade-table tbody tr:hover {
    background-color: #f0f9f5 !important;
}

.rmt-trade-table .column-primary {
    font-weight: 600;
}

/* Position grouping visual indicators */
.rmt-position-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.rmt-trade-table tbody tr {
    position: relative;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.rmt-no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--rmt-gray-600);
}

.rmt-no-data-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.rmt-no-data-text {
    font-size: 16px;
    margin: 0 0 10px 0;
}

.rmt-no-data-hint {
    font-size: 14px;
    color: var(--rmt-gray-600);
    margin: 0;
}

/* ==========================================================================
   Success/Error Messages
   ========================================================================== */

.rmt-message {
    padding: 12px 20px;
    border-radius: 4px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rmt-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.rmt-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.rmt-message-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.rmt-message-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.rmt-animate-in {
    animation: slideInUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

.rmt-trade-table-container::-webkit-scrollbar {
    height: 8px;
}

.rmt-trade-table-container::-webkit-scrollbar-track {
    background: var(--rmt-gray-100);
    border-radius: 4px;
}

.rmt-trade-table-container::-webkit-scrollbar-thumb {
    background: var(--rmt-gray-200);
    border-radius: 4px;
}

.rmt-trade-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--rmt-primary);
}

/* ==========================================================================
   Worst Performers Table
   ========================================================================== */

.rmt-worst-performers {
    margin-top: 30px;
}

.rmt-worst-performers-table {
    border: 3px solid var(--rmt-danger);
    border-radius: 8px;
    overflow: hidden;
}

.rmt-worst-performers-table table {
    border: none;
}

.rmt-worst-performers-table .rmt-stat-value {
    color: var(--rmt-danger) !important;
    font-weight: 600;
}

.rmt-worst-performers-table tbody td:nth-child(6),
.rmt-worst-performers-table tbody td:nth-child(7) {
    color: var(--rmt-danger);
    font-weight: 600;
}

/* Responsive: Stack cards on smaller screens */
@media (max-width: 1200px) {
    .rmt-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .rmt-stats-grid {
        grid-template-columns: 1fr;
    }
}

