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

body {
    font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ヘッダー */
header {
    text-align: center;
    padding: 3rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-size: 1.1rem;
    color: #666;
}

/* フィルターボタン */
.filter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 1rem;
}

.filter-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.filter-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

/* 写真ギャラリー */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, 350px); /* 固定幅に変更 */
    gap: 2rem;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 600px; /* 最小高さを確保 */
    align-content: start; /* グリッド項目を上詰めに配置 */
    justify-content: center; /* カードを中央寄せ */
}

.photo-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    cursor: pointer;
    opacity: 1;
    transform: scale(1);
    height: 400px; /* 固定高さ */
    display: flex;
    flex-direction: column;
}

.photo-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
}

.photo-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.4s ease;
    flex-shrink: 0; /* 画像サイズを固定 */
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-item h3 {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 1.3rem;
    color: #333;
    margin: 0;
    flex-shrink: 0; /* タイトル高さを固定 */
}

.photo-item p {
    padding: 0 1.5rem 1.5rem;
    color: #666;
    font-size: 0.95rem;
    margin: 0;
    flex: 1; /* 残りスペースを使用 */
    display: flex;
    align-items: flex-start; /* テキストを上揃え */
}

/* フィルター効果 */
.photo-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 800px;
    max-height: 80%;
    object-fit: contain;
    border-radius: 10px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
    font-size: 1.1rem;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
}

/* 写真アップロード機能 */
.upload-section {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.upload-toggle-btn {
    display: block;
    margin: 0 auto 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.upload-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.upload-form {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.upload-form h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
}

.upload-area {
    border: 2px dashed #667eea;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: rgba(118, 75, 162, 0.1);
    transform: scale(1.02);
}

.upload-placeholder {
    color: #666;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.upload-placeholder p {
    font-size: 1.1rem;
    margin: 0;
}

.preview-container {
    position: relative;
    display: inline-block;
}

.preview-container img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.form-fields {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
}

.field-group input,
.field-group textarea,
.field-group select {
    padding: 0.8rem;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.add-photo-btn,
.cancel-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-photo-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.add-photo-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.add-photo-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cancel-btn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e1e8ed;
}

.cancel-btn:hover {
    background: #e9ecef;
}

/* フッター */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    background: rgba(255, 255, 255, 0.9);
    color: #666;
    backdrop-filter: blur(10px);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, 300px); /* モバイルでも固定幅 */
        gap: 1.5rem;
        padding: 0 1rem;
        justify-content: center; /* 中央寄せを維持 */
    }
    
    .filter-buttons {
        margin: 1.5rem 0.5rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 70%;
    }
    
    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 2rem 1rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, 280px); /* 小画面でも固定幅 */
        padding: 0 1rem;
        justify-content: center;
    }
    
    .photo-item {
        height: 380px; /* 高さも少し調整 */
    }
    
    .photo-item img {
        height: 220px;
    }
}

/* アニメーション効果 */
.photo-item {
    animation: fadeInUp 0.6s ease forwards;
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* アップロードページ専用スタイル */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.nav-spacer {
    width: 120px;
}

.upload-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.upload-form-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ステップインジケーター */
.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 120px;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: #e1e8ed;
    z-index: 0;
}

.step.active:not(:last-child)::after {
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e1e8ed;
    color: #666;
    font-weight: bold;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    transform: scale(1.1);
}

.step-label {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.step.active .step-label {
    color: #333;
    font-weight: 500;
}

/* フォームステップ */
.form-step {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.form-step.active {
    display: block;
}

.form-step h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.8rem;
}

/* カテゴリー選択 */
.category-selection {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.category-selection select {
    flex: 1;
}

.btn-secondary {
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.new-category-form {
    margin-top: 1rem;
    padding: 1rem;
    border: 2px dashed #667eea;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.05);
}

.new-category-form input {
    margin-bottom: 0.5rem;
}

.category-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small {
    background: #667eea;
    color: white;
}

.btn-small.btn-cancel {
    background: #6c757d;
}

.custom-categories {
    margin-top: 1rem;
}

.category-tag {
    display: inline-block;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    margin: 0.2rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tag:hover {
    background: #667eea;
    color: white;
}

.category-tag.selected {
    background: #667eea;
    color: white;
}

/* 確認カード */
.confirmation-card {
    display: flex;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.confirmation-image {
    flex-shrink: 0;
}

.confirmation-image img {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
}

.confirmation-details {
    flex: 1;
}

.confirmation-details h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.4rem;
}

.confirm-category {
    color: #667eea;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.confirm-description {
    color: #666;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.confirm-location {
    color: #888;
    font-size: 0.9rem;
}

/* ステップアクション */
.step-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* 成功画面 */
.success-content {
    text-align: center;
    padding: 2rem;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* フィールドヒント */
.field-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
    display: block;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .upload-container {
        padding: 0 1rem;
    }
    
    .upload-form-card {
        padding: 1.5rem;
    }
    
    .step-indicator {
        margin-bottom: 2rem;
    }
    
    .step {
        max-width: 80px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .step-label {
        font-size: 0.8rem;
    }
    
    .confirmation-card {
        flex-direction: column;
        text-align: center;
    }
    
    .confirmation-image img {
        width: 100%;
        max-width: 250px;
    }
    
    .category-selection {
        flex-direction: column;
        align-items: stretch;
    }
    
    .step-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* スムーズスクロール */
html {
    scroll-behavior: smooth;
}