* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

.container {
    margin: 0 auto;
    padding: 20px;
}

h1 {
    margin-bottom: 30px;
    color: #222;
    font-size: 28px;
}

body.dark-mode h1 {
    color: #e0e0e0;
}

.targets-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.target-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #ddd;
}

.target-card.status-ok {
    border-left-color: #4caf50;
}

.target-card.status-ng {
    border-left-color: #f44336;
}

.target-card.status-unknown {
    border-left-color: #9e9e9e;
}

.target-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.target-name {
    font-size: 16px;
    font-weight: 600;
}

.target-type {
    display: inline-block;
    padding: 4px 8px;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 12px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.uptime-rate {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    background-color: #e3f2fd;
    color: #1976d2;
    margin-left: 8px;
    white-space: nowrap;
}

.dark-mode .uptime-rate {
    background-color: #1e3a5f;
    color: #64b5f6;
}

.status-badge.ok {
    background-color: #4caf50;
}

.status-badge.ng {
    background-color: #f44336;
}

.status-badge.unknown {
    background-color: #9e9e9e;
}

.target-info {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    word-break: break-all;
}

.target-info label {
    font-weight: 600;
    display: block;
    margin-top: 8px;
}

.target-info label:first-of-type {
    margin-top: 0;
}

.chart-container {
    margin-top: 15px;
    height: 60px;
    background-color: #fafafa;
    border-radius: 4px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    overflow: hidden;
}

.chart-wrapper {
    margin-top: 15px;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 8px;
}

.chart-bar {
    flex-shrink: 0;
    height: 100%;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-bar:hover {
    transform: scaleY(1.1);
}

.chart-bar.ok {
    background-color: #4caf50;
}

.chart-bar.ng {
    background-color: #f44336;
}

.chart-bar.unknown {
    background-color: #bdbdbd;
}

.last-check {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 12px;
    max-height: 60px;
    overflow-y: auto;
}

.tooltip {
    display: none;
    position: absolute;
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.footer {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.dark-mode .footer {
    border-top-color: #444;
    color: #aaa;
}

.dark-mode .target-card {
    background: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dark-mode .target-card {
    color: #e0e0e0;
}

.dark-mode .target-info {
    color: #b0b0b0;
}

.dark-mode .chart-container {
    background-color: #333;
}

.dark-mode .chart-labels {
    color: #666;
}

.dark-mode .loading {
    color: #555;
}

.dark-mode .error-message {
    background-color: #5c2626;
    color: #ff9999;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.dark-mode .theme-toggle {
    color: #aaa;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch.active {
    background-color: #4caf50;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.toggle-switch.active::after {
    left: 28px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.dark-mode .stat-card {
    background: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.dark-mode .stat-value {
    color: #e0e0e0;
}

.stat-value.ok {
    color: #4caf50;
}

.stat-value.ng {
    color: #f44336;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .targets-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 15px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        font-size: 11px;
    }

    .toggle-switch {
        width: 40px;
        height: 20px;
    }

    .toggle-switch::after {
        width: 16px;
        height: 16px;
        top: 2px;
        left: 2px;
    }

    .toggle-switch.active::after {
        left: 22px;
    }

    .target-card {
        padding: 15px;
    }

    .target-name {
        font-size: 14px;
    }

    .chart-container {
        height: 150px;
    }

    .chart-bar {
        min-width: 8px;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .targets-grid {
        gap: 15px;
    }

    .container {
        padding: 10px;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .target-card {
        padding: 12px;
    }

    .chart-container {
        height: 120px;
    }
}
