:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
}
.pc-view { display: block; }
.mobile-img-container, .mobile-info, .mobile-actions { display: none; }
body .hidden { display: none !important; } /* 強力な非表示設定 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
}

/* Login Page */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

.login-container {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-container p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Forms */
.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.w-100 {
    width: 100%;
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Main Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar nav {
    flex: 1;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.logout-btn {
    color: var(--danger);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.main-content {
    flex: 1;
    padding: 2rem;
    margin-left: 250px; /* Sidebar width */
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Grid & Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.card.visited {
    opacity: 0.6;
}

.card.visited h3 {
    text-decoration: line-through;
    color: var(--text-muted);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.icon-btn:hover {
    color: var(--text-main);
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-danger:hover { color: #f87171; }
.text-muted { color: var(--text-muted); }

.card-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.card-link:hover {
    text-decoration: underline;
}

/* Password Manager */
.password-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.password-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.password-card:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

.pw-info h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pw-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pw-field {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
}

.pw-field .label {
    color: var(--text-muted);
    width: 80px;
}

.pw-field .value {
    color: #e2e8f0;
    flex: 1;
}

.copy-btn, .toggle-pw-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0.2rem 0.5rem;
}

.copy-btn:hover, .toggle-pw-btn:hover {
    color: var(--primary);
}

.pw-notes {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#visitModal, #placeModal, #userModal {
    z-index: 1100;
}

.modal-content {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s ease;
}

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

.close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.close:hover {
    color: var(--text-main);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Toast */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--success);
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    font-weight: 500;
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

.category-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    font-weight: 500;
    white-space: nowrap;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: var(--text-main);
    border-color: rgba(99, 102, 241, 0.5);
}

.filter-btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: scale(1.05);
    font-weight: 700;
}


/* Category Badge Colors */
/* Universal Category Badge Colors */
.badge-food { background: rgba(245, 158, 11, 0.15) !important; color: #fbbf24 !important; border-color: rgba(245, 158, 11, 0.3) !important; }
.badge-onsen { background: rgba(239, 68, 68, 0.15) !important; color: #f87171 !important; border-color: rgba(239, 68, 68, 0.3) !important; }
.badge-sightseeing { background: rgba(16, 185, 129, 0.15) !important; color: #34d399 !important; border-color: rgba(16, 185, 129, 0.3) !important; }
.badge-play { background: rgba(59, 130, 246, 0.15) !important; color: #60a5fa !important; border-color: rgba(59, 130, 246, 0.3) !important; }
.badge-hotel { background: rgba(139, 92, 246, 0.15) !important; color: #a78bfa !important; border-color: rgba(139, 92, 246, 0.3) !important; }
.badge-other { background: rgba(148, 163, 184, 0.15) !important; color: #94a3b8 !important; border-color: rgba(148, 163, 184, 0.3) !important; }

/* Apply to place card */
.place-card[data-category="食べ物"] .category-badge { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.place-card[data-category="温泉"] .category-badge { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
.place-card[data-category="観光"] .category-badge { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.place-card[data-category="遊び"] .category-badge { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.place-card[data-category="宿泊"] .category-badge { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border-color: rgba(139, 92, 246, 0.3); }

/* Filter Button Colors (Active State) */
.filter-btn.badge-food.active { background: #fbbf24 !important; color: white !important; border-color: #fbbf24 !important; }
.filter-btn.badge-onsen.active { background: #f87171 !important; color: white !important; border-color: #f87171 !important; }
.filter-btn.badge-sightseeing.active { background: #34d399 !important; color: white !important; border-color: #34d399 !important; }
.filter-btn.badge-play.active { background: #60a5fa !important; color: white !important; border-color: #60a5fa !important; }
.filter-btn.badge-hotel.active { background: #a78bfa !important; color: white !important; border-color: #a78bfa !important; }
.filter-btn#filterWantToGo.active { background: #ef4444 !important; color: white !important; border-color: #ef4444 !important; }
@media (max-width: 768px) {
    .app-container {
        padding-bottom: 70px; /* Space for bottom nav */
    }
    .sidebar {
        position: fixed;
        bottom: 0 !important;
        top: auto !important;
        left: 0;
        width: 100%;
        height: 65px; /* 高さ固定 */
        z-index: 2100;
        padding: 0 0.5rem;
        background: rgba(30, 41, 59, 0.95);
        backdrop-filter: blur(10px);
        border-right: none;
        border-top: 1px solid var(--border);
        display: flex;
        flex-direction: row;
        align-items: center;
        overflow: hidden;
    }
    .sidebar .logo {
        display: none;
    }
    .sidebar-footer {
        display: none !important; /* スマホでは不要 */
    }
    .sidebar nav {
        display: flex;
        justify-content: space-around;
        gap: 0;
        flex: 1;
    }
    .sidebar nav a {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem;
        font-size: 0.7rem;
        margin-bottom: 0;
        flex: 1;
        text-align: center;
    }
    .sidebar nav a i {
        font-size: 1.2rem;
    }
    .main-content {
        padding: 1rem;
        margin-left: 0 !important;
        padding-bottom: 80px;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .page-header {
        margin-bottom: 1rem;
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
    }
    .page-header h2 {
        font-size: 1.2rem;
    }
    .page-header .btn-primary {
        padding: 0.5rem;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        min-width: auto;
    }
    .page-header .btn-primary span {
        display: none; /* テキストを隠す */
    }
    .pc-view { display: none !important; }
    .mobile-img-container, .mobile-info, .mobile-actions { display: flex !important; }
    .mobile-img-container { display: block !important; }
    
    .grid-container {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .place-card {
        padding: 0.5rem !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 0.75rem;
        min-height: 80px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 16px;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    /* Hide specific PC elements if they are outside .pc-view */
    .place-card .card-footer, 
    .place-card .card-description { 
        display: none !important; 
    }
    
    .place-card .mobile-img-container {
        width: 70px;
        height: 70px;
        flex-shrink: 0;
        border-radius: 8px;
        overflow: hidden;
    }
    .place-card .mobile-img-container img,
    .place-card .mobile-img-container .no-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .place-card .mobile-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
    }
    .place-card .mobile-info h3 {
        font-size: 0.95rem;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        width: 100%;
    }
    /* 長い場合に動かすアニメーション */
    .place-card:active .mobile-info h3,
    .place-card:hover .mobile-info h3 {
        display: inline-block;
        width: auto;
        padding-right: 100%; /* ループ用の余白 */
        animation: marquee 8s linear infinite;
        text-overflow: clip;
    }

    @keyframes marquee {
        0% { transform: translateX(0); }
        100% { transform: translateX(-100%); }
    }
    .place-card .mobile-meta {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
    .place-card .mobile-address {
        font-size: 0.7rem;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .place-card .mobile-actions {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        align-items: center;
    }
    .place-card .mobile-actions .icon-btn {
        padding: 0.3rem;
        font-size: 1.1rem;
    }
    .place-card .category-badge-mobile {
        font-size: 0.65rem;
        padding: 0.1rem 0.4rem;
        border-radius: 4px;
    }
}

/* Big Action Buttons for Cards */
.card-footer {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-large {
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-visit { background: var(--success); color: white; grid-column: span 2; }
.btn-visit:hover { background: #059669; }

.btn-revisit { background: #818cf8; color: white; grid-column: span 2; }
.btn-revisit:hover { background: #6366f1; }

.btn-edit { background: rgba(99, 102, 241, 0.1); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.2); }
.btn-edit:hover { background: rgba(99, 102, 241, 0.2); }

.btn-delete { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-delete:hover { background: rgba(239, 68, 68, 0.2); }

.btn-undo { background: #fbbf24; color: #000; grid-column: span 2; }

/* Better Trash Icon */
.delete-img-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.delete-img-btn:hover {
    background: var(--danger);
    transform: scale(1.1);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}
.lightbox img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* Review Items */
.review-item {
    transition: all 0.2s ease;
}
.review-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

@media (max-width: 600px) {
    #detailContent > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}
