/**
 * STK_HT003 商品カウント画面 スタイルシート
 * HT（ハンディターミナル）向けモバイルファースト設計
 */

/* ===========================
   CSS Custom Properties (Variables)
   =========================== */
:root {
    /* Primary Colors */
    --primary-color: #006f5e;
    --primary-color-dark: #005a4b;
    --primary-color-darker: #003d7a;
    
    /* Text Colors */
    --text-color: #333;
    --text-color-light: #666;
    --text-color-lighter: #999;
    --text-color-white: #fff;
    
    /* Background Colors */
    --bg-color: #f5f5f5;
    --bg-color-white: #fff;
    --bg-color-light: #f8f9fa;
    --bg-color-lighter: #e9ecef;
    --bg-color-disabled: #f0f0f0;
    
    /* Border Colors */
    --border-color: #ccc;
    --border-color-dark: #999;
    --border-color-light: #e0e0e0;
    
    /* Error Colors */
    --error-bg-color: #ffebee;
    --error-text-color: #c62828;
    --error-border-color: #ef5350;
    
    /* Success Colors */
    --success-bg-color: #e8f5e9;
    --success-text-color: #2e7d32;
    --success-border-color: #66bb6a;
    
    /* Warning Colors */
    --warning-bg-color: #ff9800;
    --warning-bg-hover: #f57c00;
    --warning-bg-active: #ef6c00;
    
    /* Button Colors */
    --button-secondary-bg: #6c757d;
    --button-secondary-bg-hover: #5a6268;
    --button-secondary-bg-active: #545b62;
    
    /* Spinner Colors */
    --spinner-bg: #f3f3f3;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-xxl: 24px;
    
    /* Border Radius */
    --border-radius: 8px;
    --border-radius-full: 50%;
    
    /* Font Sizes */
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-focus: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* ===========================
   リセットとベーススタイル
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* ===========================
   コンテナ
   =========================== */
.ht-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color-white);
}

/* ===========================
   ヘッダー
   =========================== */
.ht-header {
    flex-shrink: 0;
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--primary-color);
    color: var(--text-color-white);
    box-shadow: var(--shadow-sm);
}

.ht-title {
    font-size: var(--font-size-xl);
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
}

.ht-info {
    font-size: var(--font-size-xs);
    opacity: 0.9;
    display: flex;
    gap: var(--spacing-md);
}

.plan-info::before {
    content: "📋 ";
}

.location-info::before {
    content: "📍 ";
}

/* ===========================
   メインコンテンツ
   =========================== */
.ht-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xxl) var(--spacing-lg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* カウント済み商品数表示エリア */
.counted-items-area {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--bg-color-light);
    border-radius: var(--border-radius);
    text-align: center;
}

.counted-count-text {
    font-size: var(--font-size-base);
    font-weight: bold;
    color: var(--text-color);
}

#counted-count {
    color: var(--primary-color);
    font-size: var(--font-size-lg);
}

/* プロンプトエリア */
.prompt-area {
    margin-bottom: var(--spacing-xl);
}

.prompt-label {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--text-color);
    line-height: 1.4;
}

/* 商品情報表示エリア */
.item-info-area {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--bg-color-light);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color-light);
}

.info-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-size: var(--font-size-sm);
    font-weight: bold;
    color: var(--text-color-light);
    min-width: 100px;
}

.info-value {
    font-size: var(--font-size-base);
    font-weight: bold;
    color: var(--primary-color);
}

/* 入力エリア */
.input-area {
    margin-bottom: var(--spacing-xl);
}

.input-group {
    margin-bottom: var(--spacing-lg);
}

.input-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: var(--spacing-sm);
}

.required-mark {
    color: var(--error-text-color);
    font-weight: bold;
}

.ht-input {
    width: 100%;
    padding: 20px var(--spacing-lg);
    font-size: var(--font-size-base);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color-white);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.ht-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

.ht-input::placeholder {
    color: var(--text-color-lighter);
}

.ht-input:disabled {
    background-color: var(--bg-color-disabled);
    color: var(--text-color-lighter);
    cursor: not-allowed;
}

/* number inputの矢印を非表示（HT向け） */
.ht-input[type="number"]::-webkit-inner-spin-button,
.ht-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ht-input[type="number"] {
    -moz-appearance: textfield;
}

/* ===========================
   メッセージエリア
   =========================== */
.message {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.message-error {
    background-color: var(--error-bg-color);
    color: var(--error-text-color);
    border: 1px solid var(--error-border-color);
}

.message-success {
    background-color: var(--success-bg-color);
    color: var(--success-text-color);
    border: 1px solid var(--success-border-color);
}

/* ===========================
   ローディング表示
   =========================== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxl);
    color: var(--text-color-light);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--spinner-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: var(--border-radius-full);
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-md);
}

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

.loading-indicator p {
    font-size: var(--font-size-sm);
    color: var(--text-color-light);
}

/* ===========================
   フッター（ボタンエリア）
   =========================== */
.ht-footer {
    flex-shrink: 0;
    padding: var(--spacing-lg);
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color-light);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* ボタン共通スタイル */
.ht-button {
    width: 100%;
    padding: 16px var(--spacing-xl);
    font-size: var(--font-size-base);
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
    touch-action: manipulation;
}

.ht-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* プライマリボタン（登録） */
.ht-button-primary {
    background-color: var(--primary-color);
    color: var(--text-color-white);
}

.ht-button-primary:hover:not(:disabled) {
    background-color: var(--primary-color-dark);
}

.ht-button-primary:active:not(:disabled) {
    background-color: var(--primary-color-darker);
}

/* サクセスボタン（ロケ完了） */
.ht-button-success {
    background-color: var(--success-text-color);
    color: var(--text-color-white);
}

.ht-button-success:hover:not(:disabled) {
    background-color: #1b5e20;
}

.ht-button-success:active:not(:disabled) {
    background-color: #145a1a;
}

/* ワーニングボタン（計画完了） */
.ht-button-warning {
    background-color: var(--warning-bg-color);
    color: var(--text-color-white);
}

.ht-button-warning:hover:not(:disabled) {
    background-color: var(--warning-bg-hover);
}

.ht-button-warning:active:not(:disabled) {
    background-color: var(--warning-bg-active);
}

/* ターシャリボタン（戻るなど） */
.ht-button-tertiary {
    background-color: var(--bg-color-white);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.ht-button-tertiary:hover:not(:disabled) {
    background-color: var(--bg-color-light);
    border-color: var(--border-color-dark);
}

.ht-button-tertiary:active:not(:disabled) {
    background-color: var(--bg-color-lighter);
}

/* ===========================
   レスポンシブデザイン
   =========================== */
@media (min-width: 768px) {
    .ht-footer {
        flex-direction: row;
        justify-content: flex-end;
    }

    .ht-button {
        width: auto;
        min-width: 120px;
    }
}

/* ===========================
   アクセシビリティ
   =========================== */
.ht-button:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.ht-input:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* 画面読み上げ専用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
