/* ===== カスタムプロパティ ===== */
:root {
    --brand-primary: #4361ee;
    --brand-primary-light: #6c83f7;
    --brand-primary-dark: #2d44c4;
    --brand-accent: #f72585;
    --brand-success: #06d6a0;
    --brand-warning: #ffd166;
    --brand-surface: #f8f9fc;
    --brand-surface-alt: #ffffff;
    --brand-text: #2b2d42;
    --brand-text-muted: #8d99ae;
    --brand-border: #e2e6ef;
    --brand-radius: 12px;
    --brand-shadow: 0 2px 8px rgba(43, 45, 66, 0.06);
    --brand-shadow-hover: 0 4px 16px rgba(43, 45, 66, 0.12);
    --brand-transition: 0.2s ease;
}

/* ===== 全体のベース ===== */
body {
    background: var(--brand-surface);
    color: var(--brand-text);
}

/* ===== ナビゲーション ===== */
nav.container {
    background: var(--brand-surface-alt);
    border-bottom: 1px solid var(--brand-border);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    padding-left: 2rem;
    padding-right: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

nav a:not([role="button"]) {
    color: var(--brand-text);
    font-weight: 500;
    transition: color var(--brand-transition);
}

nav a:not([role="button"]):hover {
    color: var(--brand-primary);
}

.brand-logo {
    color: var(--brand-primary) !important;
    font-size: 1.15rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none !important;
}

/* ===== メインコンテンツ ===== */
main.container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ===== 見出し ===== */
h1, h2, h3 {
    color: var(--brand-text);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }

hgroup p {
    color: var(--brand-text-muted);
}

/* ===== カード (article) ===== */
article {
    background: var(--brand-surface-alt);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    transition: box-shadow var(--brand-transition), transform var(--brand-transition);
}

article:hover {
    box-shadow: var(--brand-shadow-hover);
}

article > header {
    border-bottom: 1px solid var(--brand-border);
    background: var(--brand-surface);
    border-radius: var(--brand-radius) var(--brand-radius) 0 0;
    padding: 1rem 1.25rem;
}

article > header > strong {
    font-size: 1rem;
    color: var(--brand-text);
}

article > footer {
    border-top: 1px solid var(--brand-border);
    background: var(--brand-surface);
    border-radius: 0 0 var(--brand-radius) var(--brand-radius);
}

/* ===== ボタン ===== */
button,
[role="button"] {
    border-radius: 8px;
    font-weight: 600;
    transition: all var(--brand-transition);
    letter-spacing: 0.01em;
}

button:not(.outline):not(.secondary):not(.contrast),
[role="button"]:not(.outline):not(.secondary):not(.contrast) {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

button:not(.outline):not(.secondary):not(.contrast):hover,
[role="button"]:not(.outline):not(.secondary):not(.contrast):hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

.outline {
    border-width: 1.5px;
}

/* ===== テーブル ===== */
table {
    border-collapse: separate;
    border-spacing: 0;
}

th {
    white-space: nowrap;
    text-align: center;
    background: var(--brand-surface);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-text-muted);
    border-bottom: 2px solid var(--brand-border);
}

tbody tr {
    transition: background var(--brand-transition);
}

tbody tr:hover {
    background: color-mix(in srgb, var(--brand-primary) 4%, transparent);
}

figure {
    border-radius: var(--brand-radius);
    overflow: hidden;
    border: 1px solid var(--brand-border);
    box-shadow: var(--brand-shadow);
    background: var(--brand-surface-alt);
}

td mark {
    white-space: nowrap;
    padding: 0.125rem 0.25rem;
}

/* ===== ステータスバッジ ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-active {
    background: color-mix(in srgb, var(--brand-success) 15%, transparent);
    color: #057a55;
}

.badge-active::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-success);
    animation: pulse-dot 2s infinite;
}

.badge-inactive {
    background: color-mix(in srgb, var(--brand-text-muted) 12%, transparent);
    color: var(--brand-text-muted);
}

.badge-admin {
    background: color-mix(in srgb, var(--brand-accent) 12%, transparent);
    color: var(--brand-accent);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== アラート ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.alert-success {
    background: color-mix(in srgb, var(--brand-success) 12%, transparent);
    color: #057a55;
    border: 1px solid color-mix(in srgb, var(--brand-success) 25%, transparent);
}

.alert-error {
    background: color-mix(in srgb, var(--brand-accent) 10%, transparent);
    color: #c81e5b;
    border: 1px solid color-mix(in srgb, var(--brand-accent) 20%, transparent);
}

/* ===== フォーム ===== */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
    border-radius: 8px;
    border: 1.5px solid var(--brand-border);
    transition: border-color var(--brand-transition), box-shadow var(--brand-transition);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

label {
    font-weight: 500;
    font-size: 0.9rem;
}

fieldset {
    border: 1px solid var(--brand-border);
    border-radius: 8px;
    padding: 1rem;
}

/* ===== ヒーローセクション ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #4361ee 0%, #7209b7 100%);
    border-radius: var(--brand-radius);
    margin-bottom: 2rem;
    color: #fff;
}

.hero h1 {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.hero p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto 1.5rem;
    line-height: 1.7;
}

.hero .badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.75rem;
    margin-bottom: 1rem;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    max-width: 360px;
    margin: 0 auto;
}

.hero-buttons a[role="button"] {
    flex: 1;
    padding: 0.6rem 1.5rem;
}

.hero-buttons a[role="button"]:not(.outline) {
    background: #fff !important;
    color: var(--brand-primary) !important;
    border-color: #fff !important;
}

.hero-buttons a[role="button"]:not(.outline):hover {
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--brand-primary-dark) !important;
    border-color: rgba(255, 255, 255, 0.9) !important;
}

.hero-buttons a.outline {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.hero-buttons a.outline:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ===== 機能カード ===== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.feature-grid article {
    text-align: center;
    padding: 1.5rem;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-grid article h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.feature-grid article p {
    color: var(--brand-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== ステップ ===== */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    counter-reset: step;
    margin-bottom: 2rem;
}

.step {
    counter-increment: step;
    padding: 1.25rem;
    position: relative;
}

.step::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.step h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.step p {
    color: var(--brand-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== ダッシュボードカード ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.25rem;
}

.stat-card header {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-text);
    margin: 0.25rem 0 0.5rem;
    letter-spacing: -0.02em;
}

/* ===== 空室結果ハイライト ===== */
.new-result {
    background-color: color-mix(in srgb, var(--brand-primary) 8%, transparent);
}

/* ===== アクションボタン群 ===== */
.action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.action-buttons button,
.action-buttons a[role="button"] {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
    border-radius: 6px;
}

/* ===== セクションヘッダー ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin-bottom: 0;
}

/* ===== フッター ===== */
footer.container {
    margin-top: 3rem;
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--brand-border);
}

footer.container small {
    color: var(--brand-text-muted);
}

footer.container a {
    color: var(--brand-text-muted);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color var(--brand-transition);
}

footer.container a:hover {
    text-decoration-color: var(--brand-text-muted);
}

/* ===== 免責事項 ===== */
.disclaimer {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 8px;
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
}

.disclaimer small {
    color: var(--brand-text-muted);
    line-height: 1.6;
}

/* ===== 認証フォーム ===== */
.auth-card {
    max-width: 420px;
    margin: 2rem auto;
    padding: 2rem;
}

.auth-card header {
    text-align: center;
    padding-bottom: 1.5rem;
}

.auth-card header h2 {
    margin-bottom: 0;
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
    color: var(--brand-text-muted);
}

/* ===== エリア検索 ===== */
#map {
    border-radius: var(--brand-radius);
    border: 1px solid var(--brand-border);
    box-shadow: var(--brand-shadow);
}

/* Leaflet コントロール — グローバルボタンスタイルの上書きをリセット */
.leaflet-control a[role="button"],
.leaflet-control button,
.leaflet-popup-close-button {
    background: #fff !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: #333 !important;
    border-radius: 0 !important;
    font-weight: normal !important;
    letter-spacing: normal !important;
}

.leaflet-control a[role="button"]:hover,
.leaflet-control button:hover,
.leaflet-popup-close-button:hover {
    background: #f4f4f4 !important;
    color: #333 !important;
}

.leaflet-control-zoom a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    line-height: 30px;
    text-decoration: none;
    font-size: 18px;
}

.leaflet-popup-close-button {
    border: none !important;
    padding: 0 !important;
    font-size: 20px !important;
}

/* ===== ガイドページ ===== */
.guide-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.guide-buttons a {
    flex: 1;
    min-width: 200px;
}

/* ===== エラーダイアログ ===== */
dialog article {
    border: 1px solid color-mix(in srgb, var(--brand-accent) 30%, transparent);
}

dialog article header {
    background: color-mix(in srgb, var(--brand-accent) 8%, transparent);
    color: var(--brand-accent);
}

/* ===== ナビゲーション（モバイル） ===== */
.nav-mobile { display: none; }

@media (max-width: 768px) {
    .nav-desktop { display: none !important; }
    .nav-mobile { display: flex; }
    nav .dropdown summary { min-height: 44px; }

    .hero {
        padding: 2rem 1rem;
    }
    .hero h1 {
        font-size: 1.6rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .hero-buttons {
        flex-direction: column;
        max-width: 280px;
    }

    th { white-space: normal; }
    .action-buttons { flex-wrap: wrap; }
    figure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { font-size: 0.85rem; }
    .action-buttons button,
    .action-buttons a[role="button"] {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    #map { height: 300px; }
    .search-form { grid-template-columns: 1fr !important; }
}
