/**
 * 裏道マップ - WordPress Plugin CSS (縦並びレイアウト版)
 * ファイル名: css/backroad-map.css
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

#backroad-map-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin: 20px 0;
}

#backroad-map-container * {
    box-sizing: border-box;
}

/* ==========================================================================
   Layout - 縦並び
   ========================================================================== */

.main-content {
    display: block;
    width: 100%;
}

.map-container {
    position: relative;
    width: 100%;
    height: 500px;
}

#backroad-map,
#backroad-osm-map {
    width: 100%;
    height: 100%;
    border: none;
}

#backroad-map-sidebar {
    background: #f8f9fa;
    padding: 30px;
    width: 100%;
    border-top: 1px solid #e1e5e9;
}

/* ==========================================================================
   Category Filter
   ========================================================================== */

.category-filter {
    background: #ffffff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.category-filter h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1rem;
}

.filter-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.filter-btn {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.filter-btn:hover {
    background: #f8f9ff;
    border-color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ==========================================================================
   Instructions
   ========================================================================== */

.instructions {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    color: #856404;
}

.instructions h3 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 1rem;
}

.instructions ol {
    margin: 0 0 0 20px;
    padding: 0;
}

.instructions li {
    margin-bottom: 5px;
    line-height: 1.4;
    font-size: 0.85rem;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.backroad-form {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.route-info {
    background: #e8f4f8;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    display: none;
}

.route-info.show {
    display: block;
}

.route-info h4 {
    margin: 0 0 8px 0;
    color: #0c5460;
    font-size: 0.95rem;
}

.route-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.form-group .required {
    color: #e74c3c;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.char-count {
    position: absolute;
    right: 5px;
    bottom: -18px;
    font-size: 0.75rem;
    color: #999;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: #5a4fdb;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-success {
    background: #2ecc71;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

/* ==========================================================================
   Statistics
   ========================================================================== */

.stats-info {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stats-info h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 0.95rem;
}

#route-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-item i {
    font-size: 1.2rem;
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
}

/* ==========================================================================
   Route Popup (InfoWindow)
   ========================================================================== */

.route-popup {
    max-width: 250px;
    padding: 10px;
}

.route-popup h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1rem;
}

.route-desc {
    margin: 8px 0;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

.route-meta {
    margin: 8px 0;
    font-size: 0.8rem;
    color: #999;
}

.route-likes {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-like {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 5px 15px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-like:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.btn-like.liked {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.like-count {
    font-weight: bold;
    color: #666;
}

/* ==========================================================================
   Alert Messages
   ========================================================================== */

.alert {
    padding: 12px 20px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.btn-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    color: inherit;
    line-height: 1;
    padding: 0;
}

.btn-close:hover {
    opacity: 1;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 991px) {
    .filter-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .map-container {
        height: 400px;
    }
    
    #backroad-map-sidebar {
        padding: 20px;
    }
}

@media (max-width: 767px) {
    #backroad-map-container {
        margin: 10px 0;
        border-radius: 10px;
    }
    
    .map-container {
        height: 350px;
    }
    
    #backroad-map-sidebar {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .instructions ol {
        margin-left: 15px;
    }
    
    #route-stats {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Google Maps Custom Styles
   ========================================================================== */

.gm-style-iw {
    max-width: 300px !important;
}

.gm-style-iw-d {
    overflow: auto !important;
    max-height: none !important;
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

#backroad-map-sidebar::-webkit-scrollbar {
    width: 6px;
}

#backroad-map-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#backroad-map-sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#backroad-map-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}