/* Common styles for the application */

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f1419;
    color: #e7e9ea;
    min-height: 100vh;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.app-header {
    background: #16181c;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.header-top {
    padding: 20px;
    display: flex;
    align-items: baseline;
    gap: 15px;
    border-bottom: 1px solid #2f3336;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-toggle {
    background: #2f3336;
    border: none;
    color: #e7e9ea;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.lang-toggle:hover {
    background: #3f4346;
}

.app-title {
    color: #1d9bf0;
    font-size: 24px;
    font-weight: 700;
}

.app-subtitle {
    color: #8b98a5;
    font-size: 14px;
}

/* Tab navigation */
.tab-nav {
    display: flex;
    padding: 0 10px;
    background: #16181c;
}

.tab-btn {
    padding: 15px 25px;
    background: transparent;
    border: none;
    color: #8b98a5;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.tab-btn.active {
    color: #1d9bf0;
    border-bottom-color: #1d9bf0;
}

.tab-btn .tab-icon {
    font-size: 18px;
}

/* Tab content */
.tab-content {
    background: #16181c;
    border-radius: 8px;
    min-height: 500px;
}

.tab-panel {
    display: none;
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

/* Common components */
.controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    color: #8b98a5;
    font-size: 13px;
}

input[type="number"],
input[type="text"],
input[type="password"],
select {
    background: #0f1419;
    border: 1px solid #2f3336;
    color: #e7e9ea;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: #1d9bf0;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background: #1d9bf0;
    color: white;
}

.btn-success {
    background: #00ba7c;
    color: white;
}

.btn-danger {
    background: #f91880;
    color: white;
}

.btn-secondary {
    background: #2f3336;
    color: #e7e9ea;
}

.btn-opinion {
    background: #6366f1;
    color: white;
}

.btn-poly {
    background: #8b5cf6;
    color: white;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

/* Stats bar */
.stats-bar {
    background: #1a1d21;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: #8b98a5;
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    color: #e7e9ea;
    font-size: 20px;
    font-weight: bold;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #1d9bf0;
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #2f3336;
    font-size: 13px;
}

tr:hover {
    background: #1c1f23;
}

/* Price styles */
.price {
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.price-yes {
    color: #00ba7c;
}

.price-no {
    color: #f91880;
}

.diff-positive {
    color: #00ba7c;
}

.diff-negative {
    color: #f91880;
}

.sim-high {
    color: #00ba7c;
}

.sim-mid {
    color: #ffd700;
}

/* Volume */
.volume {
    color: #8b98a5;
    font-size: 12px;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: #8b98a5;
}

/* Cards */
.card {
    background: #1a1d21;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2f3336;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #e7e9ea;
}

/* Form groups */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #8b98a5;
    font-size: 13px;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Status indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.connected {
    background: #00ba7c;
}

.status-dot.disconnected {
    background: #f91880;
}

.status-dot.pending {
    background: #ffd700;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}

.alert-success {
    background: rgba(0, 186, 124, 0.1);
    border: 1px solid #00ba7c;
    color: #00ba7c;
}

.alert-error {
    background: rgba(249, 24, 128, 0.1);
    border: 1px solid #f91880;
    color: #f91880;
}

.alert-warning {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    color: #ffd700;
}

.alert-info {
    background: rgba(29, 155, 240, 0.1);
    border: 1px solid #1d9bf0;
    color: #1d9bf0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #16181c;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #8b98a5;
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #2f3336;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Collapsible sections */
.collapsible {
    border: 1px solid #2f3336;
    border-radius: 8px;
    margin-bottom: 10px;
}

.collapsible-header {
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1d21;
    border-radius: 8px;
}

.collapsible-header:hover {
    background: #1c1f23;
}

.collapsible-content {
    padding: 15px;
    display: none;
    border-top: 1px solid #2f3336;
}

.collapsible.open .collapsible-content {
    display: block;
}

.collapsible-icon {
    transition: transform 0.2s;
}

.collapsible.open .collapsible-icon {
    transform: rotate(180deg);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f1419;
}

::-webkit-scrollbar-thumb {
    background: #2f3336;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3f4346;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .header-top {
        flex-direction: column;
        gap: 5px;
    }

    .tab-nav {
        overflow-x: auto;
    }

    .tab-btn {
        padding: 12px 15px;
        font-size: 13px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-bar {
        gap: 15px;
    }

    .form-row {
        flex-direction: column;
    }
}

/* WebSocket status indicator */
.ws-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 10px;
    transition: background-color 0.3s;
}

.ws-status.connected {
    background: #00ba7c;
    box-shadow: 0 0 6px #00ba7c;
}

.ws-status.disconnected {
    background: #f91880;
    box-shadow: 0 0 6px #f91880;
}

.ws-status.connecting {
    background: #ffd700;
    animation: pulse 1s infinite;
}

/* Price update animation */
@keyframes priceFlash {
    0% { background-color: transparent; }
    50% { background-color: rgba(29, 155, 240, 0.2); }
    100% { background-color: transparent; }
}

.price-updated {
    animation: priceFlash 0.5s ease-out;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Real-time indicator */
.realtime-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #8b98a5;
}

.realtime-indicator.active {
    color: #00ba7c;
}

.realtime-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.realtime-indicator.active .dot {
    animation: pulse 1.5s infinite;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2f3336;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-info:hover {
    background: #3f4346;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: #e7e9ea;
}

.user-role {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.user-role.admin {
    background: #f91880;
    color: white;
}

.user-role.user {
    background: #1d9bf0;
    color: white;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 8px;
    min-width: 150px;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #e7e9ea;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #1c1f23;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Modal content (for master password modal) */
.modal-content {
    background: #16181c;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
}

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

.modal-content .modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #e7e9ea;
}

.modal-content .modal-body {
    padding: 20px;
}

.modal-content .modal-body p {
    color: #8b98a5;
    font-size: 14px;
    margin-bottom: 15px;
}

.modal-content .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #2f3336;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Confirm dialog */
.confirm-dialog {
    padding: 24px;
    text-align: center;
}

.confirm-message {
    color: #e7e9ea;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-actions .btn {
    min-width: 80px;
}

/* Progress dialog */
.progress-dialog {
    padding: 24px;
    text-align: center;
    min-width: 300px;
}

.progress-message {
    color: #e7e9ea;
    font-size: 15px;
    margin-bottom: 16px;
}

.progress-bar-container {
    background: #2f3336;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: #1d9bf0;
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease, background 0.3s ease;
}

.progress-bar.indeterminate {
    width: 30%;
    animation: indeterminate 1.5s infinite ease-in-out;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.progress-status {
    color: #8b98a5;
    font-size: 13px;
}
