/* ====================================================
   Edge of Street - styles.css (Refactored Full Version)
   整理内容：重複の統合、レイアウトの固定、レスポンシブの最適化
   ==================================================== */

/* ----------------------------------------------------
   1. Base & Global Styles
   ---------------------------------------------------- */
body { 
    margin: 0; 
    padding: 0; 
    font-family: sans-serif; 
    overflow: hidden; 
    background-color: #f0f0f0; 
}

button { 
    padding: 10px; 
    cursor: pointer; 
    width: 100%; 
    margin-bottom: 5px; 
    border-radius: 4px; 
    border: none; 
    color: white; 
    font-weight: bold; 
}

input:not([type="radio"]), 
textarea, 
select { 
    width: 100%; 
    margin-bottom: 10px; 
    padding: 8px; 
    box-sizing: border-box; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
}

.required-mark { 
    color: red; 
    font-weight: bold; 
    margin-left: 3px; 
}

/* ----------------------------------------------------
   2. Header Area
   ---------------------------------------------------- */
header {
    background: #222;
    color: white;
    padding: 0 15px;
    height: 60px;
    z-index: 1700;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 1 auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin-left: auto;
}

#hamburger-btn {
    width: auto;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: block;
    margin: 0;
}

.site-branding {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.site-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: bold;
    font-family: 'Arial Black', sans-serif;
    line-height: 1.1;
    letter-spacing: 1px;
    white-space: nowrap;
}

.site-subtitle {
    margin: 0;
    font-size: 0.7rem;
    opacity: 0.6;
}

.auth-trigger-btn {
    width: auto;
    background: #555;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    font-size: 0.8rem;
    white-space: nowrap;
}

.header-sub-btn {
    width: auto;
    padding: 5px 8px;
    font-size: 0.8rem;
    color: white;
    border: none;
    border-radius: 4px;
    white-space: nowrap;
}
.header-sub-btn.blue { background: #007bff; }
.header-sub-btn.gray { background: #555; }

#user-info {
    display: none; 
    align-items: center;
    gap: 10px;
}

.notification-badge {
    display: none;
    background-color: #ff3b30;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    font-size: 0.75em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ----------------------------------------------------
   3. Filter Navigation (PC & Mobile)
   ---------------------------------------------------- */
/* PC用ナビゲーション */
#pc-filter-nav {
    display: flex; 
    align-items: center; 
    gap: 15px;
    background: #f8f9fa; 
    padding: 0 20px; 
    border-bottom: 1px solid #ccc;
    height: 50px; 
    box-sizing: border-box; 
    width: 100%;
    overflow-x: auto; 
    white-space: nowrap; 
    z-index: 90;
}

#pc-filter-nav label { 
    margin: 0; 
    cursor: pointer; 
    font-size: 0.9em; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    color: #333;
}

#pc-filter-nav .date-group {
    display: flex; 
    align-items: center; 
    gap: 5px;
    background: white; 
    padding: 3px 8px;
	margin-left: 10px; 
    border-radius: 4px; 
    border: 1px solid #ccc;
    height: auto; 
    min-height: 34px; 
    box-sizing: border-box;
}

#pc-filter-nav input[type="date"] {
    border: none; 
    background: transparent; 
    font-family: sans-serif; 
    font-size: 1.1em;
    width: auto; 
    min-width: 130px; 
    cursor: pointer; 
    outline: none; 
    padding: 0; 
    margin: 0;
    line-height: normal; 
    color: #333;
}

/* スマホ用フィルターバー */
#mobile-filter-bar {
    display: none; 
    width: 100%; 
    height: 45px;
    background: #f8f9fa; 
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative; 
    z-index: 1600;
}

.filter-btn {
	margin-top :3px;
    border: none; 
    background: transparent;
    font-weight: bold; 
    color: #555; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 5px;
    font-size: 0.9em; 
    transition: background 0.2s;
    flex: 1;
}

#btn-filter-date {
  flex-direction: column;
  gap: 1px;
  padding: 4px 2px;
}

.filter-btn-head {
  font-size: 0.85em;
  font-weight: bold;
  white-space: nowrap;
  line-height: 1.2;
}

.filter-btn-sub {
  font-size: 0.85em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}


#btn-filter-type { 
	border-right: 1px solid #ddd;
	white-space: nowrap;
}

.filter-btn.active {
	background: transparent;
	color: #555;
}

/* フィルタードロップダウンパネル */
.filter-panel {
    display: none; 
    position: absolute; 
    top: 105px; 
    left: 0; 
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    padding: 15px; 
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
    z-index: 1600;
}
.filter-panel.open { display: block; animation: slideDown 0.2s ease-out; }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.filter-option-group label {
    display: flex; 
    align-items: center; 
    justify-content: flex-start;
    padding: 12px 10px; 
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer; 
    font-size: 1em; 
    color: #333; 
    width: 100%; 
    box-sizing: border-box;
}

.date-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}
.date-input-container span {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.85em;
  color: #555;
}

.panel-date-input {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1.2em;
  box-sizing: border-box;
  background: #fff;
}

.panel-close-btn { width: 100%; padding: 12px; background: #333; color: white; border: none; border-radius: 4px; margin-top: 10px; font-weight: bold; font-size:1em; }

/* ----------------------------------------------------
   4. Map & Floating UI (Consolidated)
   ---------------------------------------------------- */
#map {
    position: absolute !important;
    top: 110px; /* header(60) + pc-filter(50) */
    left: 0; 
    width: 100%;
    height: calc(100vh - 110px);
    z-index: 1;
}

#pac-input {
    position: absolute !important;
    top: 125px; 
    left: 15px; 
    z-index: 10;
    width: 300px; 
    height: 40px; 
    background: white;
    border: 1px solid #ccc; 
    border-radius: 2px; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* エリア内のイベントボックス */
#event-list-box {
    position: absolute !important;
    top: 120px; 
    right: 15px;
    width: 260px; 
    max-height: 40vh;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
    z-index: 10;
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    font-size: 0.9em;
    transition: max-height 0.3s ease;
}

#event-list-box.collapsed { 
    max-height: 40px !important; 
}

#event-list-header {
    background: #FFD700; 
    color: #333; 
    padding: 10px; 
    font-weight: bold;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    cursor: pointer; 
    height: 40px; 
    box-sizing: border-box;
}

#event-list-toggle-icon { transition: transform 0.3s; transform: rotate(180deg); }
#event-list-box.collapsed #event-list-toggle-icon { transform: rotate(0deg); }

#event-list-content { overflow-y: auto; padding: 0; margin: 0; list-style: none; }
.event-item { padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; transition: background 0.2s; }
.event-item:hover { background: #fffadd; }
.event-date { color: #b8860b; font-weight: bold; font-size: 0.85em; }
.event-title { font-weight: bold; margin: 2px 0; }
.no-event-msg { padding: 20px; text-align: center; color: #888; font-size: 0.8em; }

/* ----------------------------------------------------
   5. Map Controls & InfoWindow
   ---------------------------------------------------- */
.custom-map-control-button { background-color: #fff; border: 0; border-radius: 2px; box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3); margin: 10px; padding: 0; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.custom-map-control-icon { width: 24px; height: 24px; background-image: url(./location.png); background-position: 0 0; background-repeat: no-repeat; }

.info-window-content { width: 240px; max-width: 100%; }
.info-nav-container { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 2px solid #eee; padding-bottom: 8px; }
.nav-btn { background: #444; color: white; border: none; border-radius: 4px; padding: 4px 0; width: 50px; cursor: pointer; font-size: 1.1em; }

.map-action-btn {
    display: block; width: 100%; margin-top: 5px; padding: 8px 5px;
    border: none; border-radius: 4px; cursor: pointer; 
    font-size: 0.85em; text-align: center; text-decoration: none;
    box-sizing: border-box; white-space: normal; line-height: 1.3;
}
.add-here-btn { background: #555; color: white; }
.nav-link-btn { background: #28a745; color: white; }
.comment-open-btn { background: #007bff; color: white; }
.sns-btn { background: #E1306C; color: white; display:inline-block; padding: 5px 10px; border-radius:4px; text-decoration:none; font-size:0.8em; margin:5px 0; }
#owner-actions {
    display: flex;
    gap: 10px; /* ボタン間の隙間 */
    margin-top: 5px;
}

.edit-btn, .delete-btn {
    width: auto; /* 幅指定を解除 */
    flex: 1;     /* 均等に広げる */
    margin: 0;   /* 余計なマージンを削除 */
    display: block;
}

.edit-btn { background-color: #ffc107; color: #333; }
.delete-btn { background-color: #dc3545; color: white; }

/* ----------------------------------------------------
   6. Side Menu
   ---------------------------------------------------- */
.side-menu {
    position: fixed; top: 0; left: -280px; width: 260px; height: 100%;
    background: #fff; box-shadow: 2px 0 5px rgba(0,0,0,0.3); z-index: 2500;
    transition: left 0.3s ease; display: flex; flex-direction: column;
}
.side-menu.open { left: 0; }
.menu-header { background: #222; color: white; padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.menu-title { font-weight: bold; font-size: 1.1em; }
.menu-close-btn { background: transparent; border: none; color: white; font-size: 1.5em; cursor: pointer; width: auto; padding: 0; }
.menu-content { padding: 20px; overflow-y: auto; }
.menu-content a { display: block; padding: 12px 10px; color: #333; text-decoration: none; border-bottom: 1px solid #eee; transition: background 0.2s; }
.menu-content a:hover { background: #f9f9f9; color: #007bff; }


#overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1500;
}
#overlay.menu-open {
  display: block;
  z-index: 2400;
}


/* ----------------------------------------------------
   7. Modals & Tab System
   ---------------------------------------------------- */
.modal { 
    display: none; position: fixed; top: 50%; left: 50%; 
    transform: translate(-50%, -50%); background: white; 
    padding: 20px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); 
    z-index: 2000; width: 90%; max-width: 350px; 
    max-height: 90vh; overflow-y: auto; box-sizing: border-box; 
}
.modal h3 { margin-top: 0; border-bottom: 1px solid #ddd; padding-bottom: 10px; font-size: 1.1em; }

.tab-group { display: flex; margin-bottom: 15px; border-bottom: 2px solid #ddd; }
.tab-btn { flex: 1; background: none; color: #666; border-radius: 0; margin: 0; border-bottom: 3px solid transparent; font-size: 0.9em; padding: 8px 0; }
.tab-btn.active { border-bottom: 3px solid #007bff; color: #007bff; }
.form-section { display: none; }
.form-section.active { display: block; }

.close-btn { background: #999; margin-top: 5px; }
.primary-btn { background: #007bff; }
.secondary-btn { background: #6c757d; }

.reg-extra-fields { background: transparent; padding: 0; border: none; margin-bottom: 10px; }
.reg-profile-box { background: #f8f9fa; padding: 10px; border-radius: 4px; margin-top: 10px; border: 1px solid #eee; }

/* ----------------------------------------------------
   8. Chat & Comments
   ---------------------------------------------------- */
#comment-list { max-height: 300px; overflow-y: auto; background: #f9f9f9; padding: 10px; border-radius: 4px; border: 1px solid #eee; margin-bottom: 10px; }
.chat-bubble { background: white; padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); font-size: 0.9em; position: relative; }
.chat-bubble .chat-user { font-weight: bold; font-size: 0.8em; color: #555; margin-bottom: 2px; }
.chat-bubble .chat-text { white-space: pre-wrap; }
.chat-bubble .chat-time { font-size: 0.7em; color: #999; text-align: right; margin-top: 4px; }
.chat-bubble.mine { background: #dcf8c6; margin-left: 20px; }
.chat-bubble.others { background: #fff; margin-right: 20px; }
.chat-bubble.secret { border: 2px solid #FFD700; background: #fffbee; }
.secret-label { font-size: 0.7em; background:#FFD700; color:#333; padding:1px 4px; border-radius:3px; margin-left:5px; }

#notify-list { padding: 0; margin: 0; list-style: none; }
.notify-item { padding: 10px; border-bottom: 1px solid #eee; font-size: 0.9em; cursor: pointer; }
.notify-new { color: red; font-weight: bold; font-size: 0.8em; margin-right: 5px; }

/* ----------------------------------------------------
   9. Loading & Toast Notifications
   ---------------------------------------------------- */
#loading-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 9999; flex-direction: column;
    justify-content: center; align-items: center; color: white; font-weight: bold;
}
.spinner { width: 50px; height: 50px; border: 5px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast-container {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 10000; display: flex; flex-direction: column; gap: 10px; width: 90%; max-width: 350px;
 	pointer-events: none;
}
.toast { background: #333; color: white; padding: 12px 20px; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-size: 0.9em; animation: toastIn 0.3s ease-out forwards; opacity: 0; }
.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }
.toast.info { background: #007bff; }
@keyframes toastIn {
	from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ----------------------------------------------------
   10. Responsive Overrides (Mobile)
   ---------------------------------------------------- */
@media (max-width: 768px) {
    #pc-filter-nav { display: none !important; }
    #mobile-filter-bar { display: flex !important; }

    #map {
        top: 105px; /* header(60) + mobile-filter(45) */
        height: calc(100vh - 105px);
    }

    #pac-input {
        width: 90% !important;
        left: 5% !important;
        top: 115px !important;
        margin-left: 0 !important;
    }

    /* エリア内イベントメニュー：80%幅、右5% (検索窓の右端と一致) */
    #event-list-box {
        top: 170px !important;
        width: 80% !important;
        right: 5% !important;
        left: auto !important;
        max-height: 40vh;
    }

    /* 強制開閉の固定 */
    #event-list-box.collapsed {
        max-height: 40px !important;
    }

    .site-title { font-size: 1.1em; }
    .site-subtitle, .pc-only-buttons { display: none; }
}

/* ====================================================
   ★追加：名前検索 (モバイル フィルターパネル内)
==================================================== */
.filter-name-group {
  padding: 12px 10px;
  border-bottom: 1px solid #f0f0f0;
}

.filter-name-label {
  display: block;
  font-size: 0.9em;
  color: #555;
  font-weight: bold;
  margin-bottom: 8px;
}

#filter-name {
  width: 100%;
  padding: 10px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-bottom: 6px;
}

.filter-name-clear-btn {
  width: 100%;
  padding: 8px;
  background: #eee;
  color: #555;
  border: none;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: normal;
  cursor: pointer;
  margin-bottom: 0;
}

.filter-name-clear-btn:hover {
  background: #ddd;
}

/* ====================================================
   ★追加：名前検索 (PC フィルターバー内)
==================================================== */
.pc-name-search-group {
  display: flex;
  align-items: center;
  gap: 5px;
  background: white;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
  min-height: 34px;
  box-sizing: border-box;
  margin-left: auto; /* 右端へ寄せる */
  flex-shrink: 0;
}

.pc-name-label {
  font-size: 1em;
  color: #777;
  white-space: nowrap;
}

#pc-filter-name {
  border: none;
  background: transparent;
  font-size: 0.9em;
  width: 160px;
  outline: none;
  padding: 0;
  margin: 0;
  color: #333;
}

#pc-filter-name::placeholder {
  color: #bbb;
}

.pc-name-clear-btn {
  background: transparent;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 0.85em;
  padding: 0 2px;
  width: auto;
  margin: 0;
  font-weight: normal;
  line-height: 1;
}

.pc-name-clear-btn:hover {
  color: #555;
}
