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

body {
    font-family: "Motiva Sans", Arial, sans-serif;
    background: linear-gradient(to bottom, #1b2838 0%, #2c3e50 100%);
    color: #c7d5e0;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(to right, #1b2838 5%, #2a475e 95%);
    border-bottom: 1px solid #0e1419;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 12px 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #66c0f4;
    text-decoration: none;
    margin-right: 30px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: #c7d5e0;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 3px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(102, 192, 244, 0.1);
    color: #66c0f4;
}

.connection-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d32f2f;
    box-shadow: 0 0 6px rgba(211, 47, 47, 0.6);
}

.status-indicator.connected {
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

/* Main Content */
.main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    min-height: calc(100vh - 70px);
}

/* 当侧边栏隐藏时的样式 */
.main-container.no-sidebar {
    grid-template-columns: 1fr;
}

/* Sidebar */
.sidebar {
    background: rgba(30, 45, 56, 0.8);
    border: 1px solid #3c4043;
    border-radius: 4px;
    height: fit-content;
}

.sidebar-section {
    border-bottom: 1px solid #3c4043;
    padding: 16px;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-title {
    font-size: 14px;
    font-weight: bold;
    color: #66c0f4;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-box {
    width: 100%;
    padding: 8px 12px;
    background: #1e2328;
    border: 1px solid #495057;
    border-radius: 3px;
    color: #c7d5e0;
    font-size: 13px;
}

.search-box:focus {
    outline: none;
    border-color: #66c0f4;
    box-shadow: 0 0 0 2px rgba(102, 192, 244, 0.2);
}

/* Content Area */
.content-area {
    background: rgba(30, 45, 56, 0.8);
    border: 1px solid #3c4043;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

.content-header {
    background: linear-gradient(to right, #1e2328, #2a475e);
    border-bottom: 1px solid #3c4043;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-title {
    font-size: 18px;
    color: #c7d5e0;
    font-weight: normal;
}

.view-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sort-select {
    padding: 6px 12px;
    background: #1e2328;
    border: 1px solid #495057;
    border-radius: 3px;
    color: #c7d5e0;
    font-size: 12px;
}

.sort-select:focus {
    outline: none;
    border-color: #66c0f4;
}

/* Message Toast Styles */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.message-toast {
    background: #2a475e;
    border-left: 4px solid #66c0f4;
    color: #c7d5e0;
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
    font-size: 14px;
    line-height: 1.4;
}

.message-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.message-toast.info {
    border-left-color: #66c0f4;
    background: #2a475e;
}

.message-toast.success {
    border-left-color: #5cb85c;
    background: #2d4a2d;
}

.message-toast.error {
    border-left-color: #d9534f;
    background: #4a2d2d;
}

.message-toast.warning {
    border-left-color: #f0ad4e;
    background: #4a3d2d;
}

.message-toast .message-icon {
    display: inline-block;
    margin-right: 8px;
    font-weight: bold;
}

.message-toast .message-text {
    display: inline-block;
    word-wrap: break-word;
}

/* Market Grid */
.market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

.market-panel {
    border-right: 1px solid #3c4043;
    display: flex;
    flex-direction: column;
}

.market-panel:last-child {
    border-right: none;
}

.panel-header {
    background: rgba(26, 32, 38, 0.8);
    border-bottom: 1px solid #3c4043;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 14px;
    font-weight: bold;
    color: #66c0f4;
}

.buy-orders .panel-title {
    color: #4caf50;
}

.sell-orders .panel-title {
    color: #f44336;
}

.order-form {
    padding: 12px 16px;
    border-bottom: 1px solid #3c4043;
    display: flex;
    gap: 8px;
}

.form-input {
    flex: 1;
    padding: 8px 10px;
    background: #1e2328;
    border: 1px solid #495057;
    border-radius: 3px;
    color: #c7d5e0;
    font-size: 12px;
}

.form-input:focus {
    outline: none;
    border-color: #66c0f4;
    box-shadow: 0 0 0 1px rgba(102, 192, 244, 0.3);
}

.form-input::placeholder {
    color: #6c757d;
}

.submit-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
    text-transform: uppercase;
}

.buy-btn {
    background: linear-gradient(to bottom, #4caf50, #388e3c);
    color: white;
}

.buy-btn:hover {
    background: linear-gradient(to bottom, #66bb6a, #4caf50);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.sell-btn {
    background: linear-gradient(to bottom, #f44336, #d32f2f);
    color: white;
}

.sell-btn:hover {
    background: linear-gradient(to bottom, #ef5350, #f44336);
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
}

/* Order Book */
.order-book {
    flex: 1;
    overflow-y: auto;
}

.order-book-header {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(26, 32, 38, 0.6);
    border-bottom: 1px solid #3c4043;
    font-size: 11px;
    color: #8f98a0;
    text-transform: uppercase;
    font-weight: bold;
}

.order-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    gap: 8px;
    padding: 6px 16px;
    border-bottom: 1px solid rgba(60, 64, 67, 0.3);
    font-size: 12px;
    transition: background 0.2s;
}

.order-row:hover {
    background: rgba(102, 192, 244, 0.05);
}

.order-row:last-child {
    border-bottom: none;
}

.order-price {
    font-weight: bold;
}

.buy-orders .order-price {
    color: #4caf50;
}

.sell-orders .order-price {
    color: #f44336;
}

.order-quantity {
    color: #c7d5e0;
}

.order-total {
    color: #8f98a0;
    font-size: 11px;
}

.empty-state {
    padding: 40px 16px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Transaction History */
.transaction-history {
    grid-column: 1 / -1;
    margin-top: 20px;
    background: rgba(30, 45, 56, 0.8);
    border: 1px solid #3c4043;
    border-radius: 4px;
}

.transaction-header {
    background: linear-gradient(to right, #1e2328, #2a475e);
    border-bottom: 1px solid #3c4043;
    padding: 16px 20px;
}

.transaction-title {
    font-size: 16px;
    color: #c7d5e0;
}

.transaction-list {
    max-height: 300px;
    overflow-y: auto;
}

.transaction-row {
    display: grid;
    grid-template-columns: 120px 1fr 100px 100px 140px;
    gap: 16px;
    padding: 8px 20px;
    border-bottom: 1px solid rgba(60, 64, 67, 0.3);
    font-size: 12px;
    align-items: center;
}

.transaction-row:hover {
    background: rgba(102, 192, 244, 0.05);
}

.transaction-time {
    color: #8f98a0;
}

.transaction-item {
    color: #c7d5e0;
}

.transaction-price {
    color: #66c0f4;
    font-weight: bold;
}

.transaction-quantity {
    color: #c7d5e0;
}

.transaction-total {
    color: #4caf50;
    font-weight: bold;
    text-align: right;
}

/* Connection hint */
.connection-hint {
    background: linear-gradient(to right, #1a252f, #2c3e50);
    border: 1px solid #495057;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.hint-text {
    color: #8f98a0;
    font-size: 13px;
    margin-bottom: 8px;
}

.hint-example {
    color: #66c0f4;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: rgba(102, 192, 244, 0.1);
    padding: 6px 8px;
    border-radius: 3px;
    display: inline-block;
}

.hint-guide {
    font-size: 13px;
    color: #495057;
    line-height: 1.4;
    text-align: left;
}

.hint-guide strong {
    color: #66c0f4;
}

.hint-guide a {
    color: #007bff;
    text-decoration: none;
}

.hint-guide a:hover {
    text-decoration: underline;
}

.hint-guide code {
    background: rgba(102, 192, 244, 0.15);
    color: #66c0f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .sidebar {
        order: 1;
    }
}

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

    .market-panel {
        border-right: none;
        border-bottom: 1px solid #3c4043;
    }

    .market-panel:last-child {
        border-bottom: none;
    }

    .transaction-row {
        grid-template-columns: 1fr;
        gap: 4px;
        text-align: left;
    }
}

/* Scrollbar styling */
.order-book::-webkit-scrollbar,
.transaction-list::-webkit-scrollbar {
    width: 8px;
}

.order-book::-webkit-scrollbar-track,
.transaction-list::-webkit-scrollbar-track {
    background: rgba(30, 45, 56, 0.5);
}

.order-book::-webkit-scrollbar-thumb,
.transaction-list::-webkit-scrollbar-thumb {
    background: #495057;
    border-radius: 4px;
}

.order-book::-webkit-scrollbar-thumb:hover,
.transaction-list::-webkit-scrollbar-thumb:hover {
    background: #66c0f4;
}

/* Admin styles */
.admin-link {
    background: linear-gradient(to right, #ff9800, #f57c00);
    color: white !important;
}

.admin-panel {
    display: none;
}

.admin-tabs {
    display: flex;
    background: rgba(26, 32, 38, 0.8);
    border-bottom: 1px solid #3c4043;
}

.admin-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #8f98a0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.admin-tab.active {
    color: #66c0f4;
    border-bottom-color: #66c0f4;
}

.admin-tab:hover {
    background: rgba(102, 192, 244, 0.1);
}

.admin-content {
    padding: 20px;
    display: none;
}

.admin-content.active {
    display: block;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 45, 56, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.data-table th {
    background: rgba(26, 32, 38, 0.8);
    padding: 12px;
    text-align: left;
    color: #66c0f4;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 1px solid #3c4043;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(60, 64, 67, 0.3);
    font-size: 13px;
    color: #c7d5e0;
}

.data-table tr:hover {
    background: rgba(102, 192, 244, 0.05);
}

.action-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    margin-right: 4px;
    transition: all 0.2s;
}

.btn-edit {
    background: #2196f3;
    color: white;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-freeze {
    background: #ff9800;
    color: white;
}

.btn-cancel {
    background: #9e9e9e;
    color: white;
}

.action-btn:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    color: #c7d5e0;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    background: #1e2328;
    border: 1px solid #495057;
    border-radius: 3px;
    color: #c7d5e0;
    font-size: 13px;
}

.form-control:focus {
    outline: none;
    border-color: #66c0f4;
    box-shadow: 0 0 0 2px rgba(102, 192, 244, 0.2);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 45, 56, 0.95);
    border: 1px solid #3c4043;
    border-radius: 8px;
    padding: 20px;
    min-width: 400px;
    max-width: 90vw;
}

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

.modal-title {
    font-size: 16px;
    color: #66c0f4;
}

.close-btn {
    background: none;
    border: none;
    color: #8f98a0;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #66c0f4;
}

.user-panel {
    display: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(26, 32, 38, 0.8);
    border: 1px solid #3c4043;
    border-radius: 4px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #66c0f4;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #8f98a0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Market Data Panel Styles */
.market-data-panel {
    display: none;
}

.market-data-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    height: 100%;
    padding: 20px;
}

.market-data-center {
    background: rgba(30, 45, 56, 0.8);
    border: 1px solid #3c4043;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.market-data-title {
    font-size: 16px;
    color: #66c0f4;
    margin-bottom: 16px;
    border-bottom: 2px solid #66c0f4;
    padding-bottom: 8px;
}

.price-display {
    text-align: center;
    margin: 20px 0;
}

.current-price {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4caf50;
    display: block;
}

.price-change {
    font-size: 1rem;
    margin-top: 8px;
}

.price-up { 
    color: #4caf50; 
}

.price-down { 
    color: #f44336; 
}

.market-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.market-stat-item {
    background: rgba(26, 32, 38, 0.8);
    border: 1px solid #3c4043;
    border-radius: 4px;
    padding: 12px;
    text-align: center;
}

.market-stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #66c0f4;
    display: block;
}

.market-stat-label {
    font-size: 0.9rem;
    color: #8f98a0;
    margin-top: 4px;
}

.recent-trades {
    background: rgba(26, 32, 38, 0.8);
    border-radius: 4px;
    padding: 16px;
    margin-top: 20px;
    flex: 1;
}

.trades-header {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #3c4043;
    font-weight: 600;
    color: #8f98a0;
    font-size: 11px;
    text-transform: uppercase;
}

.trade-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr 1fr;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(60, 64, 67, 0.3);
}

.trade-price {
    color: #4caf50;
    font-weight: bold;
}

.trade-time {
    color: #8f98a0;
}

.order-book-container {
    height: 400px;
    overflow-y: auto;
}

.order-book-section {
    margin-bottom: 20px;
}

.order-book-section h4 {
    margin-bottom: 8px;
    font-size: 14px;
}

.sells-section h4 {
    color: #f44336;
}

.buys-section h4 {
    color: #4caf50;
}

@media (max-width: 1200px) {
    .market-data-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

fieldset {
  border: 1px solid #495057;
  border-radius: 4px;
  padding: 16px;
  margin: 20px;
}

legend {
  font-size: 14px;
  font-weight: bold;
  color: #66c0f4;
  padding: 0 8px;
}

.form-group {
  margin-bottom: 16px;
}

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

.form-group input {
  width: 100%;
  padding: 8px 12px;
  background: #1e2328;
  border: 1px solid #495057;
  border-radius: 3px;
  color: #c7d5e0;
  font-size: 13px;
}

.form-group input:focus {
  outline: none;
  border-color: #66c0f4;
  box-shadow: 0 0 0 2px rgba(102, 192, 244, 0.2);
}

.submit-button {
  background: linear-gradient(to bottom, #66c0f4, #357abd);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s;
  margin: 0 20px 20px 20px;
}

/* Product Tabs (竖向标签页) */
.product-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-group {
  margin-bottom: 8px;
}

.product-group:last-child {
  margin-bottom: 0;
}

.product-group-header {
  padding: 8px 12px;
  margin-top: 8px;
  margin-bottom: 4px;
  color: #66c0f4;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #3c4043;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.product-group-header:hover {
  color: #8ec5f0;
  background: rgba(102, 192, 244, 0.05);
}

.product-group:first-child .product-group-header {
  margin-top: 0;
}

.group-toggle-icon {
  font-size: 10px;
  width: 12px;
  display: inline-block;
  transition: transform 0.2s;
}

.group-title {
  flex: 1;
}

.group-count {
  font-size: 11px;
  color: #8f98a0;
  font-weight: normal;
}

.product-group-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.3s ease;
}

.product-tab {
  padding: 10px 12px;
  padding-left: 28px;
  background: #1e2328;
  border: 1px solid #3c4043;
  border-radius: 3px;
  color: #c7d5e0;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-tab:hover {
  background: #252d35;
  border-color: #66c0f4;
  color: #66c0f4;
}

.product-tab.active {
  background: linear-gradient(to right, #2a475e, #357abd);
  border-color: #66c0f4;
  color: #ffffff;
  font-weight: bold;
  box-shadow: 0 0 8px rgba(102, 192, 244, 0.3);
}

.product-tab.active::before {
  content: '▶ ';
  color: #66c0f4;
  margin-right: 4px;
}

/* 我的订单标记（公共买/卖单列表中用于标识属于自己的订单） */
.my-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 4px;
    font-size: 10px;
    line-height: 1.4;
    color: #0bbb55;
    background: rgba(11, 187, 85, 0.12);
    border: 1px solid rgba(11, 187, 85, 0.35);
    border-radius: 3px;
    vertical-align: middle;
}

/* Footer */
.site-footer {
    background: linear-gradient(to right, #1b2838 5%, #2a475e 95%);
    border-top: 1px solid #3c4043;
    padding: 20px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-left .copyright {
    color: #8f98a0;
    font-size: 13px;
    margin: 0;
}

.footer-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-link {
    color: #c7d5e0;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 3px;
    transition: all 0.2s;
}

.footer-link:hover {
    background: rgba(102, 192, 244, 0.1);
    color: #66c0f4;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-right {
        justify-content: center;
    }
}