/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f7;
    color: #333;
    overflow-x: hidden;
    position: relative;
    height: 100vh;
}

/* ヘッダー */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* メインコンテナ */
.main-container {
    padding-top: 60px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 検索コンテナ */
.search-container {
    position: absolute;
    top: 80px;
    left: 16px;
    right: 16px;
    z-index: 500;
    max-width: 400px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.search-icon {
    color: #999;
    margin-right: 12px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 8px 0;
}

.btn-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.btn-search:hover {
    transform: scale(1.05);
}

.search-results {
    background: white;
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s ease;
}

.search-result-item:hover {
    background: #f8f8f8;
}

/* 地図コンテナ */
.map-container {
    flex: 1;
    width: 100%;
    position: relative;
}

/* アラートパネル */
.alerts-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 400;
    transition: transform 0.3s ease;
    max-height: 50vh;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.btn-toggle.collapsed {
    transform: rotate(180deg);
}

.alerts-list {
    padding: 16px;
    max-height: calc(50vh - 60px);
    overflow-y: auto;
}

.alert-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.alert-info {
    flex: 1;
}

.alert-location {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.alert-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 4px;
}

.alert-radius {
    color: #999;
    font-size: 12px;
}

.alert-actions {
    display: flex;
    gap: 8px;
}

.btn-alert-action {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-alert-action.edit {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.btn-alert-action.delete {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.btn-alert-action:hover {
    transform: scale(1.1);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="time"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

/* 半径入力グループ */
.radius-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.radius-input-group input[type="range"] {
    flex: 1;
}

.radius-input-group input[type="number"] {
    width: 80px;
}

.radius-unit {
    color: #666;
    font-weight: 500;
}

.radius-display {
    text-align: center;
    color: #667eea;
    font-weight: 600;
    margin-top: 8px;
}

/* スイッチトグル */
.switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.switch-input {
    display: none;
}

.switch-slider {
    width: 48px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    margin-right: 12px;
    position: relative;
    transition: background 0.3s ease;
}

.switch-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.switch-input:checked + .switch-slider {
    background: #667eea;
}

.switch-input:checked + .switch-slider::after {
    transform: translateX(24px);
}

/* 時間設定 */
.time-settings {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 16px;
}

/* 繰り返しオプション */
.repeat-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 6px;
}

.checkbox-label input[type="checkbox"]:checked + {
    background: #667eea;
    color: white;
}

/* モーダルアクション */
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #666;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* 通知モーダル */
.notification-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.notification-modal.active {
    display: flex;
}

.notification-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.notification-icon {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
    animation: ring 1s ease infinite;
}

@keyframes ring {
    0%, 100% {
        transform: rotate(0deg);
    }
    10%, 30% {
        transform: rotate(-10deg);
    }
    20%, 40% {
        transform: rotate(10deg);
    }
}

.notification-content h3 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #333;
}

.notification-content p {
    color: #666;
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 16px;
}

.notification-location {
    color: #999;
    font-size: 14px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.notification-location::before {
    content: "\f3c5";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

.notification-actions {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .search-container {
        left: 12px;
        right: 12px;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .alerts-panel {
        max-height: 40vh;
    }
}

/* カスタムマーカースタイル */
.custom-marker {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50% 50% 50% 0;
    width: 30px;
    height: 30px;
    position: relative;
    transform: rotate(-45deg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.custom-marker-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    color: white;
    font-size: 14px;
}

/* 一時マーカースタイル */
.temp-marker {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border-radius: 50% 50% 50% 0;
    width: 30px;
    height: 30px;
    position: relative;
    transform: rotate(-45deg);
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.4);
    animation: bounce-in 0.3s ease;
}

.temp-marker-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    color: white;
    font-size: 14px;
}

@keyframes bounce-in {
    0% {
        transform: rotate(-45deg) scale(0);
    }
    50% {
        transform: rotate(-45deg) scale(1.2);
    }
    100% {
        transform: rotate(-45deg) scale(1);
    }
}

/* 現在地マーカー */
.current-location-marker {
    width: 20px;
    height: 20px;
    background: #4285f4;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(66, 133, 244, 0.5);
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(66, 133, 244, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
    }
}

/* カスタムポップアップ */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.popup-content {
    padding: 8px;
}

.popup-location {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.popup-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.popup-radius {
    color: #999;
    font-size: 12px;
    margin-bottom: 12px;
}

.popup-actions {
    display: flex;
    gap: 8px;
}

.popup-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.popup-btn.edit {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.popup-btn.delete {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.popup-btn:hover {
    transform: translateY(-1px);
}

.popup-btn.edit:hover {
    background: rgba(102, 126, 234, 0.2);
}

.popup-btn.delete:hover {
    background: rgba(231, 76, 60, 0.2);
}

/* エンプティステート */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ddd;
}

.empty-state p {
    font-size: 16px;
}

/* インストールモーダル */
.install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.install-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.3s ease;
}

.install-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0 20px;
}

.install-header h3 {
    font-size: 20px;
    color: #333;
    margin: 0;
}

.install-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.install-close:hover {
    background: #f0f0f0;
}

.install-body {
    padding: 20px;
}

.install-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.install-step {
    display: flex;
    align-items: center;
    gap: 16px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text {
    flex: 1;
    line-height: 1.5;
}

.install-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.install-btn:hover {
    transform: translateY(-2px);
}

/* ローディング */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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