/* ============================================================
   card-scanner.css - 名刺スキャンモジュール用スタイル
============================================================ */
.scanner-module-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #000;
    overflow: hidden;
    font-family: sans-serif;
    color: #fff;
    border-radius: 12px;
}

.scanner-module-container * {
    box-sizing: border-box;
}

/* 撮影画面 */
.sm-screen-scanning {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.sm-screen-scanning[hidden] {
    display: none !important;
}

.sm-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.sm-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.sm-corners {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sm-card-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    max-width: 380px;
    aspect-ratio: 1 / 1.618;
    max-height: 75vh;
}

.sm-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sm-corner-tl { top: 0; left: 0; border-top: 3px solid; border-left: 3px solid; }
.sm-corner-tr { top: 0; right: 0; border-top: 3px solid; border-right: 3px solid; }
.sm-corner-bl { bottom: 0; left: 0; border-bottom: 3px solid; border-left: 3px solid; }
.sm-corner-br { bottom: 0; right: 0; border-bottom: 3px solid; border-right: 3px solid; }

.sm-corner--idle { border-color: rgba(255,255,255,0.55); }
.sm-corner--detecting { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245,158,11,0.6); }
.sm-corner--locked { border-color: #22c55e; box-shadow: 0 0 14px rgba(34,197,94,0.8); animation: sm-corner-pulse 0.6s ease-in-out infinite alternate; }

@keyframes sm-corner-pulse {
    from { box-shadow: 0 0 8px rgba(34,197,94,0.6); }
    to { box-shadow: 0 0 22px rgba(34,197,94,1); }
}

/* フォーカスインジケーター */
.sm-focus-bar-wrap {
    position: absolute;
    bottom: 68px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 320px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 8px 14px;
    backdrop-filter: blur(8px);
}

.sm-focus-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 6px;
    font-family: monospace;
}

.sm-focus-track {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.sm-focus-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: #ef4444;
    transition: width 0.3s ease, background 0.3s ease;
}

.sm-status-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    background: rgba(0,0,0,0.7);
    border-radius: 20px;
    padding: 8px 18px;
    text-align: center;
    font-size: 13px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}

.sm-status[data-type="info"] { color: rgba(255,255,255,0.9); }
.sm-status[data-type="warn"] { color: #f59e0b; }
.sm-status[data-type="good"] { color: #22c55e; }
.sm-status[data-type="error"] { color: #ef4444; }

.sm-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.05s;
}

.sm-flash.active {
    animation: sm-flash-out 0.25s ease-out forwards;
}

@keyframes sm-flash-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* 処理中画面 */
.sm-screen-processing {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
    z-index: 50;
}

.sm-screen-processing[hidden] {
    display: none !important;
}

.sm-processing-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 5;
}

.sm-processing-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    border: 2.5px solid rgba(255,255,255,0.4);
    box-shadow: 0 0 30px rgba(0,229,255,0.2);
}

.sm-spinner-yellow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border: 12px solid #f59e0b;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sm-spin-centered 1s linear infinite;
    z-index: 20;
    box-shadow: 0 0 30px rgba(245,158,11,0.5);
}

@keyframes sm-spin-centered {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.sm-processing-text {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 24px;
    border-radius: 24px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 20;
    white-space: nowrap;
}

.sm-canvas {
    display: none;
}
