/**
 * デバイスモード選択 - CSS
 * iPad MiniモードとiPhone 6モードの切り替え機能
 */

/* ============================================
   モード選択オーバーレイ
   ============================================ */

.mode-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.mode-selection-overlay.hidden {
    display: none;
}

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

/* ============================================
   モード選択コンテナ
   ============================================ */

.mode-selection-container {
    max-width: 900px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

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

/* ============================================
   ヘッダー
   ============================================ */

.mode-selection-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.mode-selection-header h1 {
    font-size: 1.75rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.mode-selection-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

/* ============================================
   コンテンツエリア
   ============================================ */

.mode-selection-content {
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ============================================
   モード選択カード
   ============================================ */

.mode-selection-card {
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.mode-selection-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mode-selection-card:hover {
    border-color: #3b82f6;
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
}

.mode-selection-card:hover::before {
    opacity: 1;
}

.mode-selection-card:active {
    transform: translateY(-2px);
}

/* アクティブ状態 */
.mode-selection-card.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(147, 51, 234, 0.08) 100%);
}

.mode-selection-card.active::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
}

/* ============================================
   カード内要素
   ============================================ */

.mode-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.mode-selection-card h2 {
    font-size: 1.5rem;
    margin: 0;
    color: #1f2937;
    text-align: center;
    font-weight: 700;
}

.mode-specs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
}

.spec-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 600;
}

.spec-value {
    font-size: 0.875rem;
    color: #1f2937;
    font-weight: 600;
    text-align: right;
}

.mode-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.feature-tag {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* ============================================
   フッター
   ============================================ */

.mode-selection-footer {
    padding: 1.5rem 2rem;
    background: #f9fafb;
    text-align: center;
}

.mode-note {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ============================================
   ヘッダーのモード切り替えボタン
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mode-switch-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.mode-switch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.mode-switch-btn:active {
    transform: translateY(0);
}

.mode-switch-icon {
    font-size: 1.125rem;
}

.mode-switch-text {
    white-space: nowrap;
}

/* ============================================
   iPad Mini モード固有のスタイル
   ============================================ */

body.device-mode-ipad-mini {
    /* iPad Mini用の調整 */
}

body.device-mode-ipad-mini .container {
    max-width: 1024px;
    padding: 1.5rem;
}

body.device-mode-ipad-mini .form-grid {
    grid-template-columns: repeat(2, 1fr);
}

body.device-mode-ipad-mini .qr-video-container {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

body.device-mode-ipad-mini .qr-scan-guide,
body.device-mode-ipad-mini .qr-scan-corners,
body.device-mode-ipad-mini .qr-scanning-line {
    width: 240px;
    height: 240px;
}

body.device-mode-ipad-mini .qr-corner {
    width: 30px;
    height: 30px;
    border-width: 3px;
}

body.device-mode-ipad-mini .btn {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

body.device-mode-ipad-mini h2 {
    font-size: 1.5rem;
}

body.device-mode-ipad-mini h3 {
    font-size: 1.25rem;
}

body.device-mode-ipad-mini .qr-controls {
    flex-direction: row;
    justify-content: center;
}

body.device-mode-ipad-mini .qr-controls .btn {
    width: auto;
    min-width: 200px;
}

/* ============================================
   iPhone 6 モード固有のスタイル
   ============================================ */

body.device-mode-iphone-6 {
    /* iPhone 6用の調整 */
}

body.device-mode-iphone-6 .container {
    padding: 0.5rem;
}

body.device-mode-iphone-6 .header h1 {
    font-size: 1rem;
}

body.device-mode-iphone-6 .form-grid {
    grid-template-columns: 1fr;
}

body.device-mode-iphone-6 .qr-video-container {
    max-height: 50vh;
}

body.device-mode-iphone-6 .qr-scan-guide,
body.device-mode-iphone-6 .qr-scan-corners,
body.device-mode-iphone-6 .qr-scanning-line {
    width: 180px;
    height: 180px;
}

body.device-mode-iphone-6 .qr-corner {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

body.device-mode-iphone-6 .btn {
    font-size: 0.9375rem;
    padding: 0.625rem 1rem;
}

body.device-mode-iphone-6 h2 {
    font-size: 1.125rem;
}

body.device-mode-iphone-6 h3 {
    font-size: 1rem;
}

body.device-mode-iphone-6 .qr-controls {
    flex-direction: column;
}

body.device-mode-iphone-6 .qr-controls .btn {
    width: 100%;
}

body.device-mode-iphone-6 .mode-switch-text {
    display: none;
}

/* ============================================
   レスポンシブ対応
   ============================================ */

@media screen and (max-width: 640px) {
    .mode-selection-content {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .mode-selection-header {
        padding: 1.5rem 1rem;
    }
    
    .mode-selection-header h1 {
        font-size: 1.375rem;
    }
    
    .mode-selection-subtitle {
        font-size: 0.875rem;
    }
    
    .mode-selection-card {
        padding: 1.25rem;
    }
    
    .mode-icon {
        font-size: 2.5rem;
    }
    
    .mode-selection-card h2 {
        font-size: 1.25rem;
    }
    
    .spec-item {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
    
    .spec-value {
        text-align: center;
    }
}

@media screen and (max-width: 375px) {
    .mode-selection-overlay {
        padding: 0;
    }
    
    .mode-selection-container {
        border-radius: 0;
        min-height: 100vh;
    }
}

/* ============================================
   印刷時は非表示
   ============================================ */

@media print {
    .mode-selection-overlay,
    .mode-switch-btn {
        display: none !important;
    }
}
