/* Trading Router Dashboard CSS */

* {
    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%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.stat-card h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
}

/* 상단 통계 패널 */
.stats-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
    flex: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
}

.stat-box h3 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

.stat-box .stat-value {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

/* 탭 네비게이션 스타일 */
.tab-navigation {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.tab-button {
    background: transparent;
    border: none;
    padding: 15px 25px;
    margin: 0 5px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.tab-button:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #5a6fd8;
}

.tab-button.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* 탭 콘텐츠 스타일 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 통일된 섹션 스타일 (모든 패널에 적용) */
.exchanges-section,
.strategies-section,
.modules-section,
.webhooks-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    color: #667eea;
    font-size: 1.8rem;
}

.control-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1rem;
}

/* 기존 중복 스타일 제거됨 - 통일된 스타일로 대체 */

.toggle-state-btn.on {
    background: #28a745;
    color: white;
}

.toggle-state-btn.off {
    background: #6c757d;
    color: white;
}

.toggle-state-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.module-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-label {
    color: #666;
    font-size: 0.9rem;
}

.info-value {
    font-weight: bold;
    color: #333;
}

.module-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.strategies-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.strategies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

.strategy-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.strategy-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.strategy-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    flex: 1;
    min-width: 200px;
}

.strategy-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.strategy-modules {
    margin-top: 20px;
}

.strategy-modules h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.module-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.module-status-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.module-status-item h5 {
    color: #495057;
    margin-bottom: 8px;
    font-size: 1rem;
}

.module-status-item .status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webhooks-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.webhooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

.webhook-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.webhook-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.webhook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.webhook-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
}

.webhook-actions {
    display: flex;
    gap: 10px;
}

.webhook-info {
    margin-bottom: 20px;
}

.webhook-info .info-row {
    margin-bottom: 10px;
}

.webhook-extra {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    margin-top: 15px;
}

.webhook-extra h5 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1rem;
}

.webhook-extra pre {
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    overflow-x: auto;
    font-size: 0.85rem;
    color: #495057;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    padding: 20px 25px;
    background: #f8f9fa;
    border-radius: 0 0 15px 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 모듈 관리 모달 스타일 */
#modules-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
}

.module-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.module-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.module-item.included {
    background: #d4edda;
    border-color: #28a745;
}

.module-item .module-name {
    font-weight: 600;
    color: #333;
}

.module-item .module-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    background: #6c757d;
    color: white;
}

.module-item .btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: 6px;
}

/* 모듈 상세 정보 스타일 */
.module-details {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e1e5e9;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #333;
    min-width: 120px;
}

.detail-value {
    color: #666;
    text-align: right;
}

.detail-value.status-on {
    color: #28a745;
    font-weight: 600;
}

.detail-value.status-off {
    color: #dc3545;
    font-weight: 600;
}

.detail-value.signal-long {
    color: #007bff;
    font-weight: 600;
}

.detail-value.signal-short {
    color: #dc3545;
    font-weight: 600;
}

.detail-value.signal-na {
    color: #6c757d;
    font-weight: 600;
}

.update-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.update-status.show {
    transform: translateX(0);
}

.update-status.success {
    background: #28a745;
}

.update-status.error {
    background: #dc3545;
}

.update-status.info {
    background: #17a2b8;
}

.refresh-controls {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.refresh-controls .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* 통일된 카드 스타일 (모든 패널에 적용) */
.exchanges-grid,
.strategies-grid,
.modules-grid,
.webhooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.exchange-card,
.strategy-card,
.module-card,
.webhook-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.exchange-card:hover,
.strategy-card:hover,
.module-card:hover,
.webhook-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

/* 통일된 헤더 스타일 */
.exchange-header,
.strategy-header,
.module-header,
.webhook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.exchange-title,
.strategy-title,
.module-title,
.webhook-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

.exchange-status,
.strategy-status,
.module-status,
.webhook-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 통일된 정보 스타일 */
.exchange-info,
.strategy-info,
.module-info,
.webhook-info {
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #666;
    min-width: 120px;
}

.info-value {
    color: #333;
    font-weight: 500;
}

/* 통일된 액션 버튼 스타일 */
.exchange-actions,
.strategy-actions,
.module-actions,
.webhook-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 2px solid #f8f9fa;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* 상태 표시기 스타일 */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-on,
.status-connected,
.status-healthy {
    background: #28a745;
}

.status-off,
.status-disconnected,
.status-disabled {
    background: #dc3545;
}

.status-warning {
    background: #ffc107;
}

.status-error {
    background: #dc3545;
}

/* 토글 버튼 스타일 */
.toggle-state-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-state-btn.on,
.toggle-state-btn.connected,
.toggle-state-btn.healthy {
    background: #28a745;
    color: white;
}

.toggle-state-btn.off,
.toggle-state-btn.disconnected,
.toggle-state-btn.disabled {
    background: #dc3545;
    color: white;
}

.toggle-state-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* 전략 전용 스타일 */
.strategy-modules {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.strategy-modules h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.module-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.module-status-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.module-status-item h5 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1rem;
}

.module-status-item .status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 모듈 신호 스타일 */
.module-signal {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.signal-long {
    background: #28a745;
    color: white;
}

.signal-short {
    background: #dc3545;
    color: white;
}

/* 웹훅 전용 스타일 */
.webhook-info .info-row:last-child {
    border-bottom: none;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modules-grid,
    .strategies-grid,
    .webhooks-grid {
        grid-template-columns: 1fr;
    }
    
    .module-header,
    .strategy-header,
    .webhook-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .module-actions,
    .webhook-actions {
        justify-content: flex-start;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
    
    .refresh-controls {
        position: static;
        margin-bottom: 20px;
        justify-content: center;
    }
}
