/* =======================
   SAIYU Tool Navi - コンポーネントCSS
   UI部品専用スタイル
   ======================= */

/* =======================
   フォーム要素
   ======================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    transition: var(--transition-fast);
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    background: white;
    cursor: pointer;
}

/* =======================
   モーダル・オーバーレイ
   ======================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

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

.modal {
    background: white;
    border-radius: var(--border-radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition-fast);
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* =======================
   アラート・通知
   ======================= */
.alert {
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left: 4px solid var(--success-color);
}

.alert-warning {
    background: #fff8e1;
    color: #f57c00;
    border-left: 4px solid var(--warning-color);
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid var(--error-color);
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid var(--info-color);
}

.alert-icon {
    font-size: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-message {
    font-size: 14px;
    line-height: 1.4;
}

/* =======================
   トースト通知
   ======================= */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(100%);
    opacity: 0;
    transition: var(--transition-normal);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 20px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--gray-600);
}

/* =======================
   ローディング要素
   ======================= */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 1px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* =======================
   バッジ・ラベル
   ======================= */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    line-height: 1;
    min-width: 20px;
    text-transform: uppercase;
}

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

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

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-error {
    background: var(--error-color);
    color: white;
}

.badge-gray {
    background: var(--gray-500);
    color: white;
}

/* =======================
   カード拡張
   ======================= */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* =======================
   テーブル
   ======================= */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.table td {
    font-size: 14px;
    color: var(--gray-800);
}

.table tr:hover {
    background: var(--gray-50);
}

/* =======================
   QRコードスキャナー用
   ======================= */
.qr-scanner {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: black;
}

.qr-video {
    width: 100%;
    height: auto;
    display: block;
}

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.qr-target {
    width: 200px;
    height: 200px;
    border: 3px solid white;
    border-radius: var(--border-radius);
    position: relative;
}

.qr-target::before,
.qr-target::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid var(--accent-color);
}

.qr-target::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.qr-target::after {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
}

/* =======================
   レスポンシブ調整
   ======================= */
@media (max-width: 480px) {
    .modal {
        max-width: 95vw;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
    
    .toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
    
    .qr-target {
        width: 150px;
        height: 150px;
    }
}