:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --border-color: #dee2e6;
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

h1 {
    margin: 0;
    font-size: 24px;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.version-link {
    text-decoration: none;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #0b57d0;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #c7dcff;
}

.version-link:hover .version-badge {
    background: #dceafe;
}

.release-notes-layout {
    max-width: 900px;
}

.page-intro {
    margin-top: 10px;
    color: #5b6470;
}

.release-notes-list {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.release-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.release-card.current {
    border-color: #9ac0ff;
    box-shadow: 0 8px 24px rgba(11, 87, 208, 0.08);
}

.release-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.release-card .release-date {
    color: #5b6470;
    font-size: 14px;
    margin-bottom: 12px;
}

.release-card .release-summary {
    margin: 0 0 12px;
    font-weight: 500;
}

.release-card ul {
    margin: 0;
    padding-left: 20px;
}

.release-card li + li {
    margin-top: 8px;
}

.release-state {
    color: #5b6470;
    margin-top: 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
}

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

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

/* Dashboard Controls */
.control-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    background-color: #f1f3f5;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

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

select {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.btn-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.range-btn {
    border: none;
    background: var(--white);
    padding: 5px 15px;
    cursor: pointer;
    border-right: 1px solid var(--border-color);
}

.range-btn:last-child {
    border-right: none;
}

.range-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
}

#refresh-btn {
    padding: 5px 15px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Chart */
.chart-container {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.alert-table-wrap {
    width: 100%;
    overflow-x: auto;
}

#alert-status-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#alert-status-table thead {
    background: #f8f9fa;
    text-align: left;
}

#alert-status-table th {
    padding: 10px;
    border-bottom: 2px solid #eee;
}

#alert-status-table .market-column {
    width: 54%;
}

#alert-status-table .price-column {
    width: 28%;
}

#alert-status-table .action-column {
    width: 18%;
}

/* Settings */
.settings-panel {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 40px;
}

.tag {
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag .remove-tag {
    cursor: pointer;
    color: #dc3545;
    font-weight: bold;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.add-amount-group {
    display: flex;
    gap: 10px;
}

.primary-btn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.primary-btn:hover {
    background-color: #0056b3;
}

.danger-btn {
    background-color: #c82333;
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.compact-btn {
    padding: 5px 10px;
    font-size: 12px;
}

.empty-table-state {
    text-align: center;
    padding: 15px;
    color: #888;
}

#alert-status-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    overflow-wrap: anywhere;
}

.status-msg {
    margin-left: 10px;
    font-size: 14px;
    color: var(--success-color);
}

/* System Status Indicator */
.status-indicator {
    position: relative;
    padding: 5px 10px;
    border-radius: 20px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    font-size: 14px;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    display: inline-block;
}

.status-indicator.ok .status-dot { background-color: #28a745; }
.status-indicator.degraded .status-dot { background-color: #d39e00; }
.status-indicator.error .status-dot { background-color: #dc3545; }
.status-indicator.loading .status-dot { background-color: #ffc107; }

.status-details-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 15px;
    z-index: 1000;
    margin-top: 5px;
    max-width: calc(100vw - 40px);
}

.status-indicator:hover .status-details-tooltip {
    display: block;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.status-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.status-item-name {
    font-weight: bold;
    color: #555;
}

.status-item-val {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-item-val.ok { color: #155724; background-color: #d4edda; }
.status-item-val.degraded { color: #6b5300; background-color: #fff3cd; }
.status-item-val.error { color: #721c24; background-color: #f8d7da; }

.status-item-time {
    font-size: 10px;
    color: #777;
}

.status-item-message {
    font-size: 10px;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.status-item-message.degraded {
    color: #856404;
}

.status-item-message.error {
    color: #b21f2d;
}

.status-empty {
    font-size: 12px;
    color: #666;
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 16px;
    }

    header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .header-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .header-title-group {
        width: 100%;
    }

    h1 {
        font-size: 22px;
    }

    .status-indicator {
        margin-right: 0;
        max-width: 100%;
    }

    .status-details-tooltip {
        left: 0;
        right: auto;
        width: min(300px, calc(100vw - 56px));
    }

    .tabs {
        width: 100%;
        gap: 0;
    }

    .tab-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 10px 8px;
    }

    .control-bar {
        align-items: stretch;
        gap: 12px;
    }

    .control-group {
        align-items: flex-start;
        flex-direction: column;
        width: 100%;
    }

    .control-group select,
    .btn-group {
        width: 100%;
    }

    .range-btn {
        flex: 1 1 0;
        padding-left: 8px;
        padding-right: 8px;
    }

    .chart-container {
        height: 480px;
    }

    .alert-status-section {
        padding: 16px !important;
    }

    #alert-status-table {
        font-size: 13px;
    }

    #alert-status-table th,
    #alert-status-table td {
        padding: 8px 6px;
    }

    #alert-status-table .market-column {
        width: 48%;
    }

    #alert-status-table .price-column {
        width: 30%;
    }

    #alert-status-table .action-column {
        width: 22%;
    }

    .add-amount-group {
        align-items: stretch;
        flex-direction: column;
    }

    .add-amount-group .primary-btn {
        align-self: flex-start;
    }
}
