/* WebSocket Trading Signal Demo - Enhanced Styling for Phase 3 & 4 */
/* Phase 5: Advanced Visualizations and Refinements */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Phase 5: Enhanced Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-20px) translateY(-10px); }
    50% { transform: translateX(20px) translateY(10px); }
    75% { transform: translateX(-10px) translateY(20px); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Phase 5: Enhanced Header with Performance Indicator */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
    animation: headerScan 3s ease-in-out infinite;
}

@keyframes headerScan {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header h1 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-size: 2.2em;
    font-weight: 600;
    position: relative;
}

.connection-status {
    text-align: center;
    font-size: 1.1em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Phase 5: Enhanced Performance Monitor */
.performance-monitor {
    position: absolute;
    top: 10px;
    right: 15px;
    display: flex;
    gap: 8px;
    font-size: 0.8em;
    color: #7f8c8d;
}

.perf-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.perf-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #27ae60;
    animation: perfPulse 2s infinite;
}

@keyframes perfPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* Enhanced Status Indicators */
.status-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    animation: pulse 2s infinite;
    position: relative;
}

.status-indicator::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: statusRing 3s linear infinite;
}

.status-indicator.connected {
    background-color: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}

.status-indicator.connected::after {
    border-color: rgba(39, 174, 96, 0.3);
}

.status-indicator.disconnected {
    background-color: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.status-indicator.disconnected::after {
    border-color: rgba(231, 76, 60, 0.3);
}

.status-indicator.connecting {
    background-color: #f39c12;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.status-indicator.connecting::after {
    border-color: rgba(243, 156, 18, 0.3);
}

.status-indicator.error {
    background-color: #8e44ad;
    box-shadow: 0 0 10px rgba(142, 68, 173, 0.5);
}

.status-indicator.error::after {
    border-color: rgba(142, 68, 173, 0.3);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes statusRing {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    50% { transform: rotate(180deg) scale(1.1); opacity: 0.7; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* Main Content Layouts */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* cTrader specific layout */
.ctrader-layout {
    grid-template-columns: 2fr 1fr;
    grid-template-areas: 
        "live-signal stats"
        "live-signal actions"
        "history market"
        "history log";
}

.live-signal-section {
    grid-area: live-signal;
}

.signal-stats-section {
    grid-area: stats;
}

.signal-actions-section {
    grid-area: actions;
}

.signal-history-section {
    grid-area: history;
}

.market-overview-section {
    grid-area: market;
}

.connection-log-section {
    grid-area: log;
}

/* Phase 5: Enhanced Section Styles with Micro-animations */
section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.3s ease;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    position: relative;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    animation: sectionUnderline 2s ease-in-out infinite;
}

@keyframes sectionUnderline {
    0%, 100% { width: 0; }
    50% { width: 30%; }
}

.signal-form-section {
    grid-column: 1 / -1;
}

/* Phase 5: Enhanced Live Signal Display with Flow Animation */
.live-signal-display {
    min-height: 400px;
    border: 3px solid #ecf0f1;
    border-radius: 12px;
    padding: 20px;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.live-signal-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, transparent 30%, rgba(52, 152, 219, 0.05) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.live-signal-display.signal-incoming::before {
    animation: signalFlow 1.5s ease-in-out;
}

@keyframes signalFlow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.no-signal-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 350px;
}

.signal-waiting {
    text-align: center;
    color: #7f8c8d;
}

.signal-waiting p {
    font-size: 1.2em;
    margin: 15px 0 5px 0;
}

.signal-waiting small {
    font-size: 0.9em;
    opacity: 0.7;
}

/* Phase 5: Enhanced Pulse Animation */
.pulse-dot {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    margin: 0 auto 15px;
    position: relative;
    animation: pulse-dot 1.5s infinite;
}

.pulse-dot::before,
.pulse-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid #3498db;
    animation: pulseRing 1.5s infinite;
}

.pulse-dot::after {
    animation-delay: 0.5s;
}

@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.live-signal-active {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border-color: #27ae60;
    animation: signal-glow 2s infinite;
}

@keyframes signal-glow {
    0% { box-shadow: 0 0 5px rgba(39, 174, 96, 0.3); }
    50% { box-shadow: 0 0 20px rgba(39, 174, 96, 0.6), 0 0 30px rgba(39, 174, 96, 0.3); }
    100% { box-shadow: 0 0 5px rgba(39, 174, 96, 0.3); }
}

/* Phase 5: Enhanced Signal Display with Particle Effects */
.current-signal {
    background: white;
    border-radius: 12px;
    padding: 25px;
    border-left: 6px solid #3498db;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: slideInSignal 0.5s ease;
    position: relative;
    overflow: hidden;
}

.current-signal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
    animation: signalScan 2s linear infinite;
}

@keyframes signalScan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.current-signal.buy {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #e8f5e8, #ffffff);
}

.current-signal.buy::before {
    background: linear-gradient(90deg, transparent, #27ae60, transparent);
}

.current-signal.sell {
    border-left-color: #e74c3c;
    background: linear-gradient(135deg, #fdf2f2, #ffffff);
}

.current-signal.sell::before {
    background: linear-gradient(90deg, transparent, #e74c3c, transparent);
}

@keyframes slideInSignal {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.signal-title {
    font-size: 1.8em;
    font-weight: bold;
    color: #2c3e50;
    position: relative;
}

.signal-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #3498db, transparent);
    animation: titleUnderline 1s ease-out;
}

@keyframes titleUnderline {
    from { width: 0; }
    to { width: 100%; }
}

.signal-time {
    background: #ecf0f1;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    color: #7f8c8d;
    position: relative;
    overflow: hidden;
}

.signal-time::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: timeShimmer 2s ease-in-out infinite;
}

@keyframes timeShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.signal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.signal-detail {
    background: rgba(52, 152, 219, 0.1);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.signal-detail:hover {
    transform: translateY(-2px);
    background: rgba(52, 152, 219, 0.15);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.signal-detail-label {
    font-size: 0.85em;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.signal-detail-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
    position: relative;
}

/* Phase 5: Enhanced Statistics with Data Visualization */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 2px solid #ecf0f1;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card.buy-stat {
    border-color: #27ae60;
    background: linear-gradient(135deg, #e8f5e8, #ffffff);
}

.stat-card.buy-stat::before {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.stat-card.sell-stat {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #fdf2f2, #ffffff);
}

.stat-card.sell-stat::before {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
    position: relative;
    transition: all 0.3s ease;
}

.stat-number.updating {
    animation: numberUpdate 0.5s ease;
}

@keyframes numberUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); color: #3498db; }
    100% { transform: scale(1); }
}

.stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: 500;
}

/* Phase 5: Enhanced Action Buttons with Ripple Effect */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.action-feedback {
    min-height: 40px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9em;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.action-feedback::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 ease;
}

.action-feedback.success {
    background: #e8f5e8;
    color: #27ae60;
    border: 1px solid #27ae60;
    animation: feedbackSlideIn 0.3s ease;
}

.action-feedback.success::before {
    left: 100%;
}

.action-feedback.error {
    background: #fdf2f2;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    animation: feedbackSlideIn 0.3s ease;
}

.action-feedback.error::before {
    left: 100%;
}

.action-feedback.info {
    background: #e3f2fd;
    color: #2196f3;
    border: 1px solid #2196f3;
    animation: feedbackSlideIn 0.3s ease;
}

.action-feedback.info::before {
    left: 100%;
}

@keyframes feedbackSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* History Controls */
.history-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 0.9em;
    background: white;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Phase 5: Enhanced Market Overview with Activity Indicators */
.market-pairs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.market-pair {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ecf0f1;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.market-pair::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1), transparent);
    transition: width 0.3s ease;
}

.market-pair.active {
    border-left-color: #3498db;
    background: #e3f2fd;
    animation: pairActivity 1s ease;
}

.market-pair.active::before {
    width: 100%;
}

@keyframes pairActivity {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.pair-name {
    font-weight: bold;
    color: #2c3e50;
}

.pair-status {
    font-size: 0.9em;
    color: #7f8c8d;
}

.pair-count {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.pair-count.updated {
    animation: countUpdate 0.5s ease;
}

@keyframes countUpdate {
    0% { transform: scale(1); background: #3498db; }
    50% { transform: scale(1.2); background: #2ecc71; }
    100% { transform: scale(1); background: #3498db; }
}

/* Form Styles */
.signal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    /* Always use a single column for a list view */
    grid-template-columns: 1fr; 
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.form-group select,
.form-group input {
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.form-group select:invalid,
.form-group input:invalid {
    border-color: #e74c3c;
}

/* Phase 5: Enhanced Button Styles with Ripple Effects */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled::before {
    display: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-outline {
    background: transparent;
    color: #3498db;
    border: 2px solid #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

/* Signal Display Styles */
.signal-display,
.signal-history,
.server-messages,
.connection-log {
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    padding: 15px;
    background: #f8f9fa;
}

/* Phase 5: Enhanced Signal Items with Micro-interactions */
.signal-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.signal-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1), transparent);
    transition: width 0.3s ease;
}

.signal-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.signal-item:hover::before {
    width: 100%;
}

.signal-item.buy {
    border-left-color: #27ae60;
}

.signal-item.sell {
    border-left-color: #e74c3c;
}

.signal-item.executed {
    background: #e8f5e8;
    border-left-color: #27ae60;
}

.signal-item.rejected {
    background: #fdf2f2;
    border-left-color: #e74c3c;
    opacity: 0.7;
}

.signal-item h4 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.signal-item p {
    margin: 4px 0;
    color: #666;
    font-size: 0.9em;
}

.signal-item .timestamp {
    color: #95a5a6;
    font-size: 0.8em;
    font-style: italic;
}

.signal-item .signal-status {
    float: right;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.signal-status::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: statusShimmer 2s ease-in-out infinite;
}

@keyframes statusShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.signal-status.executed {
    background: #27ae60;
    color: white;
}

.signal-status.rejected {
    background: #e74c3c;
    color: white;
}

.signal-status.pending {
    background: #f39c12;
    color: white;
}

/* Server Message Styles */
.server-message,
.connection-message {
    background: #e8f5e8;
    border: 1px solid #27ae60;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 0.9em;
    animation: slideIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

.server-message::before,
.connection-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #27ae60;
    animation: messageIndicator 2s ease-in-out infinite;
}

@keyframes messageIndicator {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.server-message.error,
.connection-message.error {
    background: #fdf2f2;
    border-color: #e74c3c;
    color: #c0392b;
}

.server-message.error::before,
.connection-message.error::before {
    background: #e74c3c;
}

.server-message.acknowledgment,
.connection-message.info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.server-message.acknowledgment::before,
.connection-message.info::before {
    background: #2196f3;
}

.server-message.warning,
.connection-message.warning {
    background: #fff3cd;
    border-color: #f39c12;
    color: #856404;
}

.server-message.warning::before,
.connection-message.warning::before {
    background: #f39c12;
}

/* Counter Badge */
.counter {
    background: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    position: relative;
    transition: all 0.3s ease;
}

.counter.updated {
    animation: counterPulse 0.5s ease;
}

@keyframes counterPulse {
    0% { transform: scale(1); background: #3498db; }
    50% { transform: scale(1.1); background: #2ecc71; }
    100% { transform: scale(1); background: #3498db; }
}

/* No Content Messages */
.no-signal,
.no-history,
.no-messages {
    text-align: center;
    color: #95a5a6;
    font-style: italic;
    padding: 20px;
    position: relative;
}

.no-signal::before,
.no-history::before,
.no-messages::before {
    content: '📭';
    display: block;
    font-size: 2em;
    margin-bottom: 10px;
    animation: emptyState 3s ease-in-out infinite;
}

@keyframes emptyState {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Phase 5: Export and Advanced Features */
.export-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.export-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ctrader-layout {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "live-signal"
            "stats"
            "actions"
            "history"
            "market"
            "log";
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    /* .form-row rule for grid-template-columns is no longer needed here, as it's globally set to 1fr */
    /* 
    .form-row {
        grid-template-columns: 1fr;
    }
    */
    
    .button-group,
    .action-buttons {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 15px;
    }
    
    section {
        padding: 20px;
    }
    
    .signal-details {
        grid-template-columns: 1fr;
    }
    
    .performance-monitor {
        position: static;
        justify-content: center;
        margin-top: 10px;
    }

    /* Phase 5: Ensure signal form section stacks on mobile */
    .signal-form-section {
        grid-column: auto; /* Reset grid column span for stacking */
    }
}

/* Scrollbar Styling */
.signal-history::-webkit-scrollbar,
.server-messages::-webkit-scrollbar,
.connection-log::-webkit-scrollbar {
    width: 6px;
}

.signal-history::-webkit-scrollbar-track,
.server-messages::-webkit-scrollbar-track,
.connection-log::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.signal-history::-webkit-scrollbar-thumb,
.server-messages::-webkit-scrollbar-thumb,
.connection-log::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.signal-history::-webkit-scrollbar-thumb:hover,
.server-messages::-webkit-scrollbar-thumb:hover,
.connection-log::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Phase 5: Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Phase 5: Success/Error States */
.success-state {
    animation: successPulse 0.6s ease;
}

.error-state {
    animation: errorShake 0.6s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background-color: rgba(39, 174, 96, 0.1); }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
} 