/* ===================================================
   イベント忘れ物管理システム - 公開ページ CSS
   =================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --transition: 0.2s ease;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.site-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    gap: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-area i {
    font-size: 2rem;
    opacity: 0.9;
}

.logo-area h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.logo-area .subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 300;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.5);
    color: white;
}

.btn-outline:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

.btn-reserve {
    background: var(--success);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
}

.btn-reserve:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-reserve:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* --- Info Bar --- */
.info-bar {
    background: var(--primary-light);
    border-bottom: 1px solid #bfdbfe;
    padding: 12px 0;
}

.info-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item i {
    flex-shrink: 0;
}

/* --- Filter Section --- */
.filter-section {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 20px 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

/* Floating Search Mode */
.filter-section.is-floating {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    box-shadow: var(--shadow-xl);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 15px 0;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-box {
    position: relative;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-icon-inside {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition);
    background: var(--gray-50);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
}

.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip {
    padding: 6px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 999px;
    background: white;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.last-update {
    opacity: 0.8;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 24px 0 48px;
}

.state-container {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.state-container i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.state-container p {
    font-size: 1rem;
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

/* --- Spinner --- */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Items Grid --- */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* --- Item Card --- */
.item-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-100);
}

.item-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.card-photo {
    aspect-ratio: 4/3;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-photo .no-photo {
    text-align: center;
    color: var(--gray-400);
}

.card-photo .no-photo i {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.card-photo .no-photo p {
    font-size: 0.8rem;
}

.card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.card-category {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.category-財布 { background: #fef3c7; color: #92400e; }
.category-衣類 { background: #dbeafe; color: #1e40af; }
.category-鍵 { background: #f3e8ff; color: #6b21a8; }
.category-バッグ { background: #fce7f3; color: #9d174d; }
.category-電子機器 { background: #ccfbf1; color: #115e59; }
.category-アクセサリー { background: #fff7ed; color: #9a3412; }
.category-飲食物 { background: #ecfdf5; color: #065f46; }
.category-傘 { background: #eff6ff; color: #1e3a8a; }
.category-書類 { background: #f5f5f4; color: #44403c; }
.category-その他 { background: var(--gray-100); color: var(--gray-700); }

.card-management-no {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 600;
    font-family: monospace;
    white-space: nowrap;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.5;
    margin-bottom: 4px;
}

.card-description {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.5;
    flex: 1;
}

.ci-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.ci-description {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.6;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--gray-500);
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.status-保管中 {
    background: var(--success-light);
    color: var(--success);
}

.status-照合中 {
    background: var(--warning-light);
    color: #b45309;
}

.card-footer {
    padding: 14px 18px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
}

.confirm-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.confirm-item .ci-category {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.confirm-item .ci-description {
    font-size: 0.9rem;
    color: var(--gray-700);
}

.confirm-item .ci-meta {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 6px;
}

.modal-note {
    font-size: 0.82rem;
    color: var(--gray-600);
    background: var(--warning-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-note i {
    color: var(--warning);
    margin-right: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group label i {
    color: var(--gray-400);
    margin-right: 2px;
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Success / Error */
.success-icon {
    text-align: center;
    margin-bottom: 16px;
}

.success-icon i {
    font-size: 4rem;
    color: var(--success);
}

.error-icon {
    text-align: center;
    margin-bottom: 16px;
}

.error-icon i {
    font-size: 4rem;
    color: var(--danger);
}

.modal-step h3 {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--gray-800);
}

.reservation-result {
    text-align: center;
    background: var(--success-light);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.reservation-label {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.reservation-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success);
    font-family: monospace;
    letter-spacing: 0.05em;
}

.reservation-note {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 12px;
    line-height: 1.6;
}

.error-message {
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* --- QR Code Area --- */
.qr-code-area {
    margin: 20px auto 16px;
    display: flex;
    justify-content: center;
}

.qr-code-area canvas {
    border: 4px solid white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

/* --- Screenshot Warning --- */
.screenshot-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--danger-light);
    border: 2px solid var(--danger);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    animation: pulse-border 2s ease-in-out infinite;
}

.screenshot-warning > i {
    font-size: 1.5rem;
    color: var(--danger);
    flex-shrink: 0;
    margin-top: 2px;
}

.screenshot-warning strong {
    font-size: 0.95rem;
    color: var(--danger);
    display: block;
    margin-bottom: 4px;
}

.screenshot-warning p {
    font-size: 0.8rem;
    color: var(--gray-700);
    line-height: 1.5;
    margin: 0;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--danger); }
    50% { border-color: #fca5a5; }
}

/* --- Search FAB --- */
.search-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.search-fab.visible {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.search-fab:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.search-fab:active {
    transform: scale(0.95);
}

/* Close Button (Floating Mode only) */
.close-search-btn {
    display: none;
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--gray-600);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.filter-section.is-floating .close-search-btn {
    display: flex;
}

/* --- Footer --- */
.site-footer {
    background: var(--gray-800);
    color: var(--gray-400);
    text-align: center;
    padding: 24px 20px;
    font-size: 0.82rem;
}

.footer-note {
    margin-top: 6px;
    opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header-content {
        padding: 12px 0;
    }

    .logo-area i {
        font-size: 1.5rem;
    }

    .logo-area h1 {
        font-size: 1.1rem;
    }

    .info-content {
        flex-direction: column;
        gap: 8px;
    }

    .items-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .filter-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .chip {
        flex-shrink: 0;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-actions .btn span {
        display: none;
    }

    .header-actions .btn {
        padding: 8px 12px;
    }

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

    .card-photo {
        aspect-ratio: 16/10;
    }
}
