/* グローバルスタイル */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

/* ヘッダースタイル */
header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

header h1 {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* カードスタイル */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 600;
}

/* スキャナーコンテナ */
.scanner-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto;
    border: 3px solid var(--primary-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #000;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* スキャナーライン */
.scanner-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff00, transparent);
    animation: scanAnimation 2s linear infinite;
}

@keyframes scanAnimation {
    0% {
        transform: translateY(-100px);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(100px);
        opacity: 0;
    }
}

/* ボタンスタイル */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn i {
    margin-right: 0.5rem;
}

/* 出席リスト */
.attendance-list {
    max-height: 400px;
    overflow-y: auto;
}

.attendance-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.attendance-item:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
}

.attendance-item .student-id {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.attendance-item .student-name {
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.attendance-item .timestamp {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.attendance-item .status-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* 統計カード */
.card.border-primary,
.card.border-success,
.card.border-warning,
.card.border-info {
    border-width: 2px !important;
}

.card-body i {
    margin-bottom: 0.5rem;
}

/* 検索バー */
#searchInput {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    transition: var(--transition);
}

#searchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* アラート */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow);
}

.alert i {
    margin-right: 0.5rem;
}

/* スキャンステータス */
#scanStatus {
    border-radius: var(--border-radius);
    font-weight: 500;
}

/* 最終スキャン情報 */
#lastScanned {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* フッター */
footer {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    .scanner-container {
        height: 250px;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .attendance-list {
        max-height: 300px;
    }
}

@media (max-width: 576px) {
    .scanner-container {
        height: 200px;
    }
    
    .row > .col-6,
    .row > .col-4,
    .row > .col-8 {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn {
        width: 100% !important;
    }
}

/* アニメーション */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* カスタムスクロールバー */
.attendance-list::-webkit-scrollbar {
    width: 6px;
}

.attendance-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.attendance-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.attendance-list::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* ローディングスピナー */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 成功アニメーション */
.success-animation {
    animation: successPulse 0.6s ease-in-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        background-color: white;
    }
    50% {
        transform: scale(1.02);
        background-color: #d4edda;
    }
    100% {
        transform: scale(1);
        background-color: white;
    }
}