/* ==========================================================================
   Design System & Global Variables (デザインシステムとグローバル変数)
   ========================================================================== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #131b2e;
    --bg-glass: rgba(22, 30, 49, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-focus: #6366f1;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-primary: #6366f1; /* Indigo */
    --color-primary-hover: #4f46e5;
    --color-success: #10b981; /* Emerald */
    --color-success-hover: #059669;
    --color-warning: #f59e0b; /* Amber */
    --color-danger: #ef4444;  /* Rose */
    --color-info: #06b6d4;    /* Cyan */
    
    --font-sans: 'Outfit', 'Inter', 'Noto Sans JP', sans-serif;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Reset & Base Styles (リセットと基本スタイル)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* フォームの共通非表示クラス */
[hidden] {
    display: none !important;
}

/* スクリーンリーダー専用クラス (SEO・アクセシビリティ用) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Typography & Scrollbars (タイポグラフィとスクールバー)
   ========================================================================== */
h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Header Component (ヘッダーコンポーネント)
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    color: var(--color-success);
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}

.header-logo h1 {
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ユーザーシミュレーター */
.user-simulator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-glass);
}

.sim-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.custom-select {
    width: 100%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    padding: 0.4rem 2rem 0.4rem 0.8rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

.custom-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.role-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.role-badge.admin {
    background: rgba(245, 158, 11, 0.15);
    color: #fde047;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Navigation Tabs (ナビゲーションタブ)
   ========================================================================== */
.app-nav {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 15px -3px rgba(99, 102, 241, 0.2);
}

.tab-icon {
    width: 1.1rem;
    height: 1.1rem;
}

/* ==========================================================================
   Main Container & Views Layout (メインコンテナとレイアウト)
   ========================================================================== */
.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 5rem 2rem;
}

.tab-view {
    animation: fadeIn 0.4s ease-out forwards;
}

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-header h2 {
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    width: 100%;
}

/* ==========================================================================
   Timeline / Gantt Chart View (タイムライン・ガントチャート)
   ========================================================================== */
.timeline-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.date-pager {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 0.25rem 0.5rem;
    gap: 0.25rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 2.2rem;
    height: 2.2rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.period-label {
    font-weight: 600;
    padding: 0 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-group {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 0.25rem;
}

.group-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.875rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
    white-space: nowrap;
}

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

/* ガントコンテナ */
.gantt-container-wrapper {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
}

.gantt-legend {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-color {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    display: inline-block;
}

.legend-color.reserved { background: var(--color-primary); }
.legend-color.rented { background: var(--color-info); }
.legend-color.repairing { background: var(--color-warning); }

/* スティッキー・ガントテーブル */
.gantt-chart-table {
    display: grid;
    overflow-x: auto;
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    background: rgba(0, 0, 0, 0.15);
    max-height: 550px;
}

/* 線表グリッドセルの構造 */
.gantt-row {
    display: flex;
    border-bottom: 1px solid var(--border-glass);
    min-width: max-content;
    min-height: 48px;
}

.gantt-row:last-child {
    border-bottom: none;
}

.gantt-header-row {
    background: rgba(10, 14, 23, 0.85);
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 600;
}

.gantt-cell-label {
    width: 180px;
    padding: 0.4rem 0.75rem;
    flex-shrink: 0;
    border-right: 1px solid var(--border-glass);
    background: var(--bg-secondary);
    font-size: 0.8rem;
    position: sticky;
    left: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-cell-label strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-cell-label .equip-cat {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.gantt-timeline-cells {
    display: flex;
    flex-grow: 1;
    position: relative;
}

.gantt-time-cell {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0.25rem 0;
    cursor: cell;
    transition: background 0.2s;
}

.gantt-header-row .gantt-time-cell {
    cursor: default;
    background: transparent;
    border-right: 1px solid var(--border-glass);
}

.gantt-row:not(.gantt-header-row) .gantt-time-cell:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* タイムライン上の予約バー */
.gantt-bar {
    position: absolute;
    height: 70%;
    top: 15%;
    border-radius: var(--border-radius-sm);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, filter 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 2;
}

.gantt-bar:hover {
    transform: scaleY(1.05);
    filter: brightness(1.15);
    z-index: 5;
}

.gantt-bar.reserved {
    background: linear-gradient(135deg, var(--color-primary) 0%, #4338ca 100%);
}

.gantt-bar.rented {
    background: linear-gradient(135deg, var(--color-info) 0%, #0891b2 100%);
}

.gantt-bar.repairing {
    background: linear-gradient(135deg, var(--color-warning) 0%, #d97706 100%);
    cursor: not-allowed;
}

.gantt-bar.lost {
    background: linear-gradient(135deg, var(--color-danger) 0%, #be123c 100%);
    cursor: not-allowed;
}

/* ==========================================================================
   Equipment List View (機材一覧・検索ビュー)
   ========================================================================== */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: var(--bg-glass);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-glass);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.8rem;
    flex-grow: 1;
    max-width: 450px;
    position: relative;
}

.search-icon {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.filter-selects {
    display: flex;
    gap: 0.75rem;
}

/* 機材カードグリッド */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.equipment-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.equipment-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--shadow-premium);
}

.equipment-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary);
}

.equipment-card.cat-lighting::before { background: var(--color-primary); }
.equipment-card.cat-cable::before { background: var(--color-info); }
.equipment-card.cat-other::before { background: var(--text-muted); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.card-title h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.card-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-badge.available {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.rented {
    background: rgba(6, 182, 212, 0.15);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.status-badge.repairing {
    background: rgba(245, 158, 11, 0.15);
    color: #fde047;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.lost {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.card-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.card-info-item {
    display: flex;
    gap: 0.5rem;
}

.card-info-label {
    color: var(--text-muted);
    min-width: 65px;
}

.card-actions {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
    width: 100%;
}

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

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

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

.btn-success:hover {
    background: var(--color-success-hover);
}

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

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

.btn-info {
    background: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.btn-info:hover {
    background: #0284c7;
    color: white;
    border-color: transparent;
}

/* ==========================================================================
   Quick Actions View (スマホ用 貸出・返却クイック操作ビュー)
   ========================================================================== */
.quick-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.quick-card-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium);
}

.panel-title {
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.title-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-primary);
}

.quick-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 500px;
    flex-grow: 1;
}

.quick-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.quick-item-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.quick-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quick-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.quick-item-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.quick-action-btn-wrapper {
    flex-shrink: 0;
    width: 110px;
}

.quick-action-btn-wrapper button {
    height: 44px; /* スマホ押しやすさ考慮(44px) */
    font-weight: 600;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px dashed var(--border-glass);
    border-radius: var(--border-radius-md);
    height: 100%;
}

.empty-icon {
    width: 2rem;
    height: 2rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ==========================================================================
   Admin Panel Component (管理者機能)
   ========================================================================== */
.admin-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    position: relative;
}

.admin-left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 5rem;
}

.admin-form-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    height: fit-content;
}

.admin-form-panel h3 {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
}

.admin-list-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    min-height: 500px;
}

.admin-list-panel h3 {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 650px;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.1);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.row-actions {
    display: flex;
    gap: 0.5rem;
}

.row-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    width: auto;
}

/* 管理者限定画面オーバーレイ */
.admin-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 90;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius-lg);
}

.lock-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    text-align: center;
    max-width: 450px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.lock-icon {
    width: 3.5rem;
    height: 3.5rem;
    color: var(--color-warning);
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

/* ==========================================================================
   Form Controls (フォーム部品)
   ========================================================================== */
.standard-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row > * {
    min-width: 0;
}

label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.required {
    color: var(--color-danger);
    margin-left: 2px;
}

input[type="text"],
input[type="datetime-local"],
textarea {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    padding: 0.6rem 0.8rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.readonly-input {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

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

/* ==========================================================================
   Modal Dialog Layout (モーダルダイアログ)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeInModal 0.25s ease-out forwards;
}

.modal-backdrop[hidden] {
    display: none !important;
}

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

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    animation: slideInModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.close-btn svg {
    width: 1.2rem;
    height: 1.2rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-prompt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-footer button {
    width: auto;
    min-width: 100px;
}

/* 重複エラーバナー */
.error-banner {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    animation: shake 0.4s ease;
}

.error-icon {
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ==========================================================================
   Toast Notification System (トースト通知)
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-left: 4px solid var(--color-primary);
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.875rem;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-danger { border-left-color: var(--color-danger); }

/* ==========================================================================
   Responsive Design & Mobile Bottom Nav (レスポンシブデザインとスマホ用下ナビ)
   ========================================================================== */
@media (max-width: 1024px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-left-column {
        position: static;
    }
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    /* ヘッダー: 2行グリッド構成で左寄り・はみ出しを解消 */
    .app-header {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        align-items: center;
    }
    
    .header-logo {
        justify-content: flex-start;
    }
    
    .header-nav-links {
        margin: 0 !important;
        display: flex;
        justify-content: flex-end;
    }
    
    .header-nav-links a {
        font-size: 0.85rem !important;
        padding: 0.35rem 0.7rem !important;
        white-space: nowrap;
    }
    
    .user-simulator {
        grid-column: 1 / -1; /* 下段全体 */
        width: 100%;
        margin: 0;
        justify-content: space-between;
        padding: 0.5rem 1rem;
        box-sizing: border-box;
    }
    
    .sim-label {
        font-size: 0.85rem;
    }
    
    #login-user-name {
        font-size: 0.95rem;
    }

    .app-main {
        padding: 1rem 1rem 7.5rem 1rem; /* 下部ナビがあるためpadding-bottomを広く */
    }

    /* スマホはナビゲーションバーを画面下部に固定 */
    .app-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        box-sizing: border-box;
        background: rgba(10, 14, 23, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-glass);
        z-index: 500;
        padding: 0.5rem 0.25rem calc(0.5rem + env(safe-area-inset-bottom, 0px)) 0.25rem;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
        justify-content: stretch;
        box-shadow: 0 -10px 25px rgba(0,0,0,0.5);
    }

    .nav-tab {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        padding: 0.5rem 0;
        border-radius: var(--border-radius-sm);
        border: none;
    }
    
    .nav-tab span {
        white-space: nowrap;
        font-size: 0.8rem; /* 文字サイズを13pxに拡大して見やすく */
        font-weight: 500;
        letter-spacing: -0.02em;
    }
    
    .nav-tab.active {
        background: transparent;
        color: var(--color-primary);
        box-shadow: none;
    }
    
    .nav-tab.active .tab-icon {
        color: var(--color-primary);
        filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
    }

    .tab-icon {
        width: 1.4rem; /* アイコンも少し拡大 */
        height: 1.4rem;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .timeline-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .date-pager {
        width: 100%;
        justify-content: space-between;
    }
    
    .mode-switcher {
        width: 100%;
    }
    
    .mode-switcher button {
        flex-grow: 1;
    }

    /* 線表テーブルの調整 */
    .gantt-chart-table {
        max-height: 400px;
    }

    .gantt-cell-label {
        width: 130px; /* スマホではラベル列を少し広く保ち折り返しを防止 */
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
        white-space: nowrap;
    }
    
    .gantt-time-cell {
        width: 80px; /* 時間セルも狭く */
        padding: 0.15rem 0;
    }

    /* クイック操作画面 */
    .quick-panels {
        grid-template-columns: 1fr; /* スマホでは1列縦並び */
        gap: 1.5rem;
    }
    
    .quick-card-panel {
        min-height: auto;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .modal-card {
        width: 95%;
    }

    /* ==========================================================================
       管理者機材一覧テーブルのカード化 (重要)
       ========================================================================== */
    .admin-table-wrapper {
        overflow-x: visible !important; /* スクロール不要 */
    }
    
    .admin-table {
        min-width: 100% !important; /* 650px制限を解除して画面幅にフィット */
        display: block;
        border: none;
    }
    
    .admin-table thead {
        display: none; /* ヘッダー非表示 */
    }
    
    .admin-table tbody {
        display: flex;
        flex-direction: column;
        gap: 1.25rem; /* カード間の隙間 */
        width: 100%;
    }
    
    .admin-table tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-glass);
        border: 1px solid var(--border-glass);
        border-radius: var(--border-radius-lg);
        padding: 1.25rem;
        gap: 0.75rem;
        position: relative;
        box-shadow: var(--shadow-premium);
        box-sizing: border-box;
        width: 100%;
    }
    
    .admin-table td {
        display: flex;
        align-items: center;
        padding: 0 !important;
        border: none !important;
        font-size: 0.95rem; /* 文字サイズ拡大 */
        width: 100%;
        min-height: 2rem;
    }
    
    /* セルの左側にラベルを表示 */
    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        width: 100px;
        flex-shrink: 0;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    
    /* ステータスセレクトボックスの幅調整 */
    .admin-table td select {
        width: calc(100% - 100px) !important;
        max-width: 250px;
        font-size: 0.9rem !important;
    }
    
    /* 操作列のボタンコンテナ */
    .admin-table td:last-child {
        margin-top: 0.5rem;
        padding-top: 0.75rem !important;
        border-top: 1px solid var(--border-glass) !important;
    }
    
    .admin-table td:last-child::before {
        align-self: flex-start;
        margin-top: 0.25rem;
    }
    
    .row-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        width: calc(100% - 100px);
    }
    
    .row-actions button {
        flex-grow: 1;
        padding: 0.5rem 0.75rem !important; /* タップしやすいサイズ */
        font-size: 0.85rem !important;
        height: auto;
    }
    
    /* ==========================================================================
       カテゴリー管理テーブルのカード化 (スマホ用)
       ========================================================================== */
    #admin-category-list {
        display: flex !important;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #admin-category-list tr {
        display: flex !important;
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
        border-radius: var(--border-radius-md);
    }
    
    #admin-category-list td {
        display: flex !important;
        align-items: center;
        min-height: auto;
    }
    
    #admin-category-list td:last-child {
        margin-top: 0.25rem;
        padding-top: 0.5rem !important;
    }
    
    #admin-category-list td:last-child::before {
        margin-top: 0.5rem;
    }
    
    #admin-category-list .row-actions {
        max-width: 100% !important;
        width: calc(100% - 100px);
    }
    
    #admin-category-list .row-actions button {
        padding: 0.4rem 0.6rem !important;
    }
}

/* PC用のデフォルトカテゴリー管理テーブル定義（フレックスボックス化を防ぐ） */
#admin-category-list {
    display: table-row-group;
}
#admin-category-list tr {
    display: table-row;
}
#admin-category-list td {
    display: table-cell;
}

/* ==========================================================================
   Equipment Photo Styles (機材写真関連の追加スタイル)
   ========================================================================== */
.card-photo-wrapper {
    width: 100%;
    height: 90px;
    position: relative;
    overflow: hidden;
    background: #131b2e;
    border-bottom: 1px solid var(--border-glass);
}

.card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.equipment-card:hover .card-photo {
    transform: scale(1.06);
}

.card-photo-wrapper.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-photo-wrapper.placeholder.cat-lighting {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.2) 100%);
}
.card-photo-wrapper.placeholder.cat-cable {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(6, 182, 212, 0.2) 100%);
}
.card-photo-wrapper.placeholder.cat-other {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.08) 0%, rgba(100, 116, 139, 0.2) 100%);
}

.placeholder-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ==========================================================================
   タグ関連のスタイル (タグフィルター & タグバッジ)
   ========================================================================== */
.tag-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 0.75rem;
}

.tag-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.tag-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.tag-filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.tag-filter-btn-count {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 9999px;
    padding: 0.05rem 0.35rem;
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--text-muted);
}

.tag-filter-btn.active .tag-filter-btn-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* カードおよびリスト用タグバッジ */
.tag-badges-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.tag-badge {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: var(--transition-smooth);
}

.tag-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ==========================================================================
   Calendar View Styles (カレンダー表示スタイル)
   ========================================================================== */
.calendar-container {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    backdrop-filter: blur(12px);
}

/* カレンダーグリッド（7列 = 日〜土） */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* 曜日ヘッダー */
.calendar-weekday-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-weekday-header.sun { color: var(--color-danger); }
.calendar-weekday-header.sat { color: var(--color-info); }

/* 日付セル */
.calendar-day-cell {
    min-height: 80px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.35rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.calendar-day-cell:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass);
}

.calendar-day-cell.other-month {
    opacity: 0.3;
}

.calendar-day-cell.today {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.calendar-day-cell.selected {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

/* 日付番号 */
.calendar-day-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.calendar-day-cell.today .calendar-day-number {
    color: var(--color-primary);
}

.calendar-day-cell.sun .calendar-day-number { color: #f87171; }
.calendar-day-cell.sat .calendar-day-number { color: #38bdf8; }
.calendar-day-cell.other-month .calendar-day-number { color: var(--text-muted); }

/* セル内の予約テキスト（PC表示） */
.calendar-event-text {
    font-size: 0.65rem;
    line-height: 1.3;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.calendar-event-text.reserved {
    background: rgba(99, 102, 241, 0.5);
}

.calendar-event-text.rented {
    background: rgba(6, 182, 212, 0.5);
}

/* セル内の予約ドット（スマホ用表示） */
.calendar-event-dots {
    display: none; /* PC時は非表示 */
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 0.2rem;
}

.calendar-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.calendar-event-dot.reserved { background: var(--color-primary); }
.calendar-event-dot.rented { background: var(--color-info); }

/* 選択日の詳細パネル */
.calendar-day-detail {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-glass);
    min-height: 60px;
}

.calendar-detail-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1rem;
}

.calendar-detail-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.calendar-detail-list {
    list-style: none;
    padding: 0;
}

.calendar-detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.4rem;
    border-radius: 6px;
    transition: var(--transition-smooth);
    font-size: 0.85rem;
}

.calendar-detail-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.calendar-detail-item + .calendar-detail-item {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.calendar-detail-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calendar-detail-status.reserved { background: var(--color-primary); }
.calendar-detail-status.rented { background: var(--color-info); }

.calendar-detail-time {
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 95px;
}

.calendar-detail-user {
    color: var(--text-primary);
    font-weight: 500;
}

.calendar-detail-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: auto;
    white-space: nowrap;
}

.calendar-detail-badge.reserved {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.calendar-detail-badge.rented {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
}

.calendar-no-events {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.75rem;
}

.calendar-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.calendar-add-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    color: white;
}

/* ==========================================================================
   Calendar Responsive (カレンダーレスポンシブ)
   ========================================================================== */
@media (max-width: 768px) {
    .calendar-day-cell {
        min-height: 48px;
        padding: 0.25rem;
    }

    .calendar-day-number {
        font-size: 0.7rem;
    }

    /* スマホではテキスト非表示→ドット表示 */
    .calendar-event-text {
        display: none;
    }

    .calendar-event-dots {
        display: flex;
    }

    .calendar-container {
        padding: 0.75rem;
    }
}

/* ==========================================================================
   Issue Report Display Styles (返却報告表示スタイル)
   ========================================================================== */

/* 機材カード上の「報告あり」バッジ */
.issue-badge-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.issue-badge-warning:hover {
    background: rgba(245, 158, 11, 0.3);
    color: #fde68a;
    transform: scale(1.05);
}

/* 機材カード上の直近報告スニペット */
.issue-snippet {
    margin-top: 0.4rem;
    padding: 0.5rem 0.65rem;
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--color-warning);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.issue-snippet:hover {
    background: rgba(245, 158, 11, 0.14);
}

.issue-snippet-label {
    font-size: 0.7rem;
    color: #fbbf24;
    font-weight: 600;
    display: block;
    margin-bottom: 0.15rem;
}

.issue-snippet-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 機材カードの「報告履歴を見る」ボタン */
.btn-history {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
    width: auto;
}

.btn-history:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.4);
}

/* 予約モーダル内の注意喚起エリア */
.notice-box-alert {
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid var(--color-warning);
    border-radius: var(--border-radius-sm);
    margin-top: 0.5rem;
    animation: fadeInNotice 0.3s ease-out forwards;
}

.notice-box-alert-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.notice-box-alert-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

/* ==========================================================================
   Equipment History Modal (機材報告履歴モーダル)
   ========================================================================== */
.equipment-history-modal-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--border-radius-lg);
    width: 92%;
    max-width: 600px;
    max-height: 80vh;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    animation: slideInModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    display: flex;
    flex-direction: column;
}

.equipment-history-modal-card .modal-body {
    overflow-y: auto;
    flex: 1;
}

.equip-history-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--border-glass);
}

.equip-history-summary-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.equip-history-summary-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #a5b4fc;
}

.equip-history-summary-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.equip-history-summary-name {
    font-weight: 600;
    font-size: 1rem;
}

.equip-history-summary-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* 報告履歴のタイムライン */
.issue-history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 1.25rem;
    position: relative;
}

.issue-history-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--color-warning), rgba(245, 158, 11, 0.15));
    border-radius: 1px;
}

.issue-history-item {
    position: relative;
    padding: 0.75rem 0 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.issue-history-item:last-child {
    border-bottom: none;
}

.issue-history-item::before {
    content: '';
    position: absolute;
    left: -0.95rem;
    top: 1.05rem;
    width: 10px;
    height: 10px;
    background: var(--color-warning);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    z-index: 1;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.issue-history-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.issue-history-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.issue-history-item-user {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.issue-history-item-status {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
}

.issue-history-item-status.has-issue {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.issue-history-item-status.no-issue {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.issue-history-item-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 0.4rem 0.6rem;
    background: rgba(245, 158, 11, 0.06);
    border-radius: var(--border-radius-sm);
    border-left: 2px solid var(--color-warning);
}

.issue-history-no-report {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.issue-history-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.issue-history-empty svg {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

/* ダッシュボード線表上の報告マーク */
.gantt-bar-issue-mark {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    vertical-align: middle;
}

/* 管理者画面未処理報告アラートパネル */
.admin-alert-banner {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.admin-alert-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: #fbbf24;
    font-size: 1rem;
    margin-bottom: 0.85rem;
}

.admin-alert-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.admin-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.9rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--color-warning);
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-alert-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 220px;
}

.admin-alert-item-equip {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.admin-alert-item-report {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.admin-alert-item-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Drag and Drop Sorting (ドラッグ＆ドロップ並び替え)
   ========================================================================== */
.drag-handle {
    cursor: grab;
    user-select: none;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-smooth);
    font-size: 1.1rem;
    line-height: 1;
}

.drag-handle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-primary);
}

.drag-handle:active {
    cursor: grabbing;
}

tr.admin-row-draggable {
    transition: background 0.15s ease, border 0.15s ease;
}

tr.admin-row-draggable.dragging {
    opacity: 0.35;
    background: rgba(99, 102, 241, 0.15) !important;
}

/* タイムライン表の現在時刻・本日のハイライト */
.gantt-time-cell.now-cell {
    background: rgba(99, 102, 241, 0.3) !important;
    border-bottom: 3px solid var(--color-primary) !important;
    color: #a5b4fc !important;
    font-weight: 700;
    position: relative;
}

.gantt-time-cell.now-cell::after {
    content: 'NOW';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.6rem;
    padding: 0.05rem 0.3rem;
    background: var(--color-primary);
    color: white;
    border-radius: 4px;
    font-weight: 800;
}

/* タイムライン表の現在時刻・本日のハイライト */
.gantt-time-cell.today-cell {
    background: rgba(16, 185, 129, 0.2) !important;
    border-bottom: 3px solid var(--color-success) !important;
    color: #6ee7b7 !important;
    font-weight: 700;
}

/* ==========================================================================
   Admin History Timeline View (管理者過去利用履歴タイムライン表示)
   ========================================================================== */
.admin-history-timeline-wrapper {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
    border-left: 2px solid var(--border-glass);
}

.history-timeline-date-group {
    position: relative;
    margin-bottom: 1.75rem;
}

.history-timeline-date-badge {
    position: absolute;
    left: -2.85rem;
    top: -0.25rem;
    background: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
    z-index: 2;
}

.history-timeline-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.history-timeline-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-md);
    padding: 0.9rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
    position: relative;
}

.history-timeline-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px);
}

.history-timeline-card.has-issue {
    border-left: 4px solid var(--color-warning);
}

.history-timeline-card.resolved-issue {
    border-left: 4px solid var(--color-success);
}

.history-timeline-card-main {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.history-timeline-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-timeline-card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.history-timeline-card-report {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    color: #fde68a;
    margin-top: 0.25rem;
}

.history-timeline-card-report.resolved {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

/* --- 複数タグ選択 (マルチタグ機能) 用スタイル --- */
.tag-mode-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.25rem 0.55rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-mode-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

.tag-mode-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    border-color: #60a5fa;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* モーダル内クリック選択タグチップ */
.modal-tag-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.modal-tag-chip:hover {
    background: rgba(96, 165, 250, 0.2);
    border-color: #60a5fa;
}

.modal-tag-chip.selected {
    background: rgba(59, 130, 246, 0.25);
    border-color: #3b82f6;
    color: #93c5fd;
    font-weight: 600;
}

/* --- カレンダー空き状況ステータスバッジ (○/×/△) --- */
.calendar-status-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
    width: 100%;
}

.calendar-status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.calendar-status-badge .symbol {
    font-weight: 800;
    font-size: 0.75rem;
}

/* ○ 貸出可 (緑) */
.calendar-status-badge.available {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* × 貸出中 (赤) */
.calendar-status-badge.rented {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* △ 利用不可 (黄) */
.calendar-status-badge.repairing {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Mobile Responsive Navigation & Bottom Space Fix (スマホ画面表示・ボトム空間調整)
   ========================================================================== */
@media (max-width: 768px) {
    .app-main {
        padding: 1rem 1rem 100px 1rem !important; /* ボトムナビ下の潜り込み防止用パディング */
    }

    .app-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
        background: rgba(10, 14, 23, 0.95) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: stretch !important;
        padding: 0.4rem 0.5rem 0.5rem 0.5rem !important;
        z-index: 1000 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5) !important;
        box-sizing: border-box !important;
    }

    /* 非表示の管理者タブは完全に幅をゼロ化 */
    .app-nav > #tab-admin[style*="display: none"],
    .app-nav > .nav-tab[style*="display: none"] {
        display: none !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 0 !important;
    }

    /* 表示されているタブのみを全幅に完璧3等分/4等分配信 */
    .app-nav > .nav-tab:not([style*="display: none"]) {
        flex: 1 1 0px !important;
        width: 100% !important;
        justify-content: center !important;
        flex-direction: column !important;
        gap: 0.2rem !important;
        padding: 0.4rem 0.25rem !important;
        font-size: 0.75rem !important;
        border: none !important;
        border-radius: 8px !important;
        margin: 0 2px !important;
        box-sizing: border-box !important;
    }

    .nav-tab.active {
        background: rgba(99, 102, 241, 0.25) !important;
    }

    /* 各ブロック間の無駄なマージン・ギャップの圧縮 */
    .view-header {
        margin-bottom: 0.6rem !important;
    }

    .filter-bar {
        margin-bottom: 0.6rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    .tag-filter-container {
        margin-bottom: 0.6rem !important;
    }

    .gantt-container-wrapper {
        padding: 0.5rem !important;
    }
}




