/* 図書貸出管理システム - カスタムスタイル */

/* バーコードスキャナー関連 */
#scanner-container {
    position: relative;
    min-height: 300px;
}

#interactive.viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#interactive.viewport canvas,
#interactive.viewport video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

#interactive.viewport canvas.drawing,
#interactive.viewport canvas.drawingBuffer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    height: 100% !important;
}

/* メッセージ表示 */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background-color: #10b981;
    color: white;
}

.alert-error {
    background-color: #ef4444;
    color: white;
}

.alert-info {
    background-color: #3b82f6;
    color: white;
}

.alert-warning {
    background-color: #f59e0b;
    color: white;
}

/* アニメーション */
@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* モーダル */
#modal {
    display: none;
}

#modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

/* テーブルスタイル */
.book-table {
    width: 100%;
    border-collapse: collapse;
}

.book-table th {
    background-color: #f3f4f6;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.book-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.book-table tr:hover {
    background-color: #f9fafb;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-available {
    background-color: #10b981;
    color: white;
}

.status-borrowed {
    background-color: #f59e0b;
    color: white;
}

/* ローディングスピナー */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .book-table {
        font-size: 0.875rem;
    }
    
    .book-table th,
    .book-table td {
        padding: 0.5rem;
    }
    
    /* モバイルでのボタンサイズ調整 */
    button {
        min-height: 44px; /* iOSの推奨タップターゲットサイズ */
    }
    
    input, select, textarea {
        font-size: 16px; /* iOSでの自動ズームを防ぐ */
        min-height: 44px;
    }
}

/* iOSのSafari対応 */
@supports (-webkit-touch-callout: none) {
    input[type="date"] {
        min-height: 44px;
        -webkit-appearance: none;
    }
    
    /* スクロール時のパフォーマンス向上 */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ボタンホバーエフェクト */
button {
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
}

/* フォーカススタイル */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
    border-color: transparent;
}

/* カード効果 */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 検索バー */
.search-bar {
    position: relative;
}

.search-bar input {
    padding-left: 2.5rem;
}

.search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* フィルターボタン */
.filter-button {
    position: relative;
}

.filter-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #3b82f6;
}