/* ネットワーク速度測定ツール - スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.language-selector {
    position: absolute;
    top: 0;
    right: 0;
}

#languageSelect {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    backdrop-filter: blur(10px);
    cursor: pointer;
}

#languageSelect option {
    background: #333;
    color: white;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.speed-test-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.location-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.history-section {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.test-controls {
    text-align: center;
    margin-bottom: 30px;
}

.primary-button {
    background: linear-gradient(45deg, #00ff88, #00cc6a);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

.primary-button:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.secondary-button:disabled {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    transform: none;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00cc6a);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    color: white;
    font-size: 0.9rem;
    text-align: center;
}

.progress-text.complete {
    color: #00ff88;
}

.progress-text.error {
    color: #ff4444;
}

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

.result-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.result-card h3 {
    color: white;
    font-size: 1rem;
    margin-bottom: 10px;
}

.speed-value {
    font-size: 2rem;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.unit {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 5px;
}

.connection-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.connection-info h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.info-grid {
    display: grid;
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.info-value {
    color: white;
    font-weight: 500;
}

.location-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.location-status {
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 15px;
    min-width: 150px;
    text-align: center;
}

.location-status.loading {
    background: rgba(255, 235, 59, 0.2);
    color: #ffeb3b;
}

.location-status.success {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.location-status.error {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

.map-container {
    height: 300px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.coordinates {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.history-container {
    max-height: 400px;
    overflow-y: auto;
}

.empty-history {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    padding: 40px;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #00ff88;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-date {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.history-location {
    color: white;
    font-weight: 500;
}

.history-speeds {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.speed-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.speed-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.speed-value {
    color: #00ff88;
    font-weight: bold;
}

.speed-unit {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.history-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.isp-info {
    font-style: italic;
}

.connection-type {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
}

.map-popup {
    font-size: 0.9rem;
}

.map-popup h4 {
    color: #333;
    margin-bottom: 5px;
}

.map-popup p {
    color: #666;
    margin-bottom: 3px;
}

footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* スクロールバーのスタイル */
.history-container::-webkit-scrollbar {
    width: 8px;
}

.history-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.history-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .language-selector {
        position: static;
        margin-top: 10px;
        text-align: center;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .speed-test-section,
    .location-section {
        padding: 20px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .speed-value {
        font-size: 1.5rem;
    }
    
    .location-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .location-status {
        min-width: auto;
    }
    
    .history-speeds {
        flex-direction: column;
        gap: 10px;
    }
    
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .history-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .speed-test-section,
    .location-section,
    .history-section {
        padding: 15px;
    }
    
    .primary-button {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .secondary-button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .map-container {
        height: 200px;
    }
    
    .speed-value {
        font-size: 1.2rem;
    }
    
    .history-item {
        padding: 15px;
    }
}

/* フォーカススタイル */
button:focus,
select:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

/* アニメーション */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 2s infinite;
}

/* Leafletマップのスタイル調整 */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.9);
}

.leaflet-control-zoom {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
}

.leaflet-control-zoom a:hover {
    background: white;
}