/* =============================================
   デリバリーシステム - style.css
   ============================================= */

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

:root {
    --ds-primary:    #f97316;
    --ds-primary-dk: #ea580c;
    --ds-secondary:  #6b7280;
    --ds-success:    #10b981;
    --ds-danger:     #ef4444;
    --ds-warning:    #f59e0b;
    --ds-bg:         #f8fafc;
    --ds-white:      #ffffff;
    --ds-border:     #e2e8f0;
    --ds-text:       #1e293b;
    --ds-text-muted: #64748b;
    --ds-radius:     12px;
    --ds-radius-sm:  8px;
    --ds-shadow:     0 2px 12px rgba(0,0,0,.08);
    --ds-shadow-lg:  0 4px 24px rgba(0,0,0,.12);
}

/* ── リセット ── */
.ds-wrap * {
    box-sizing: border-box;
    max-width: 100%;
    word-break: break-word;
}
.ds-wrap input,
.ds-wrap textarea,
.ds-wrap select,
.ds-wrap img {
    max-width: 100%;
    box-sizing: border-box;
}

/* テーマのコンテナを全幅に */
body:has(.ds-wrap) .entry-content,
body:has(.ds-wrap) .post-content,
body:has(.ds-wrap) .page-content,
body:has(.ds-wrap) .wp-block-post-content,
body:has(.ds-wrap) main,
body:has(.ds-wrap) article,
body:has(.ds-wrap) .container,
body:has(.ds-wrap) .site-content {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ── ラッパー ── */
.ds-wrap {
    width: 100%;
    padding: 0;
    background: var(--ds-bg);
    min-height: 100vh;
    font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
    color: var(--ds-text);
    font-size: 15px;
    line-height: 1.6;
}

/* ── ヘッダー ── */
.ds-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--ds-white);
    border-bottom: 1px solid var(--ds-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.ds-user-name { font-size: 14px; color: var(--ds-text-muted); font-weight: 600; }
.ds-logout-btn {
    background: none;
    border: 1px solid var(--ds-border);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12px;
    color: var(--ds-text-muted);
    cursor: pointer;
    transition: all .2s;
}
.ds-logout-btn:hover { background: var(--ds-danger); color: #fff; border-color: var(--ds-danger); }

/* ── ステップインジケーター ── */
.ds-step-indicator {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--ds-white);
    border-bottom: 1px solid var(--ds-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ds-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.ds-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ds-border);
    color: var(--ds-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    transition: all .3s;
}
.ds-step-active .ds-step-circle {
    background: var(--ds-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(249,115,22,.2);
}
.ds-step-done .ds-step-circle {
    background: var(--ds-success);
    color: #fff;
}
.ds-step-label {
    font-size: 10px;
    color: var(--ds-text-muted);
    white-space: nowrap;
}
.ds-step-active .ds-step-label { color: var(--ds-primary); font-weight: 700; }
.ds-step-done  .ds-step-label  { color: var(--ds-success); }
.ds-step-line {
    flex: 1;
    height: 2px;
    background: var(--ds-border);
    min-width: 16px;
    margin-bottom: 16px;
    transition: background .3s;
}
.ds-step-line-done { background: var(--ds-success); }

/* ── ページタイトル ── */
.ds-page-title {
    font-size: 18px;
    font-weight: 700;
    padding: 16px 16px 8px;
    color: var(--ds-text);
}

/* ── フィールド ── */
.ds-field {
    background: var(--ds-white);
    border-radius: var(--ds-radius);
    padding: 16px;
    margin: 0 12px 12px;
    box-shadow: var(--ds-shadow);
}
.ds-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ds-text-muted);
    margin-bottom: 8px;
    letter-spacing: .03em;
}
.ds-required::after { content: ' *'; color: var(--ds-danger); }

/* ── インプット ── */
.ds-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    font-size: 16px;
    color: var(--ds-text);
    background: var(--ds-bg);
    transition: border-color .2s;
    -webkit-appearance: none;
}
.ds-input:focus {
    outline: none;
    border-color: var(--ds-primary);
    background: var(--ds-white);
}
.ds-input.ds-input-error { border-color: var(--ds-danger); }
input[type="date"].ds-input { min-height: 50px; }

/* ── パスワードトグル ── */
.ds-password-wrap { position: relative; }
.ds-toggle-pw {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    font-size: 18px; cursor: pointer; padding: 4px;
}

/* ── ラジオボタン ── */
.ds-radio-group { display: flex; flex-direction: column; gap: 10px; }
.ds-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: all .2s;
    font-size: 15px;
    background: var(--ds-bg);
}
.ds-radio-label:has(input:checked) {
    border-color: var(--ds-primary);
    background: #fff7ed;
    font-weight: 600;
}
.ds-radio-label input[type="radio"] {
    width: 20px; height: 20px;
    accent-color: var(--ds-primary);
    flex-shrink: 0;
}

/* ── チェックボックス ── */
.ds-check-group { display: flex; flex-direction: column; gap: 10px; }
.ds-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: all .2s;
    font-size: 15px;
    background: var(--ds-bg);
}
.ds-check-label:has(input:checked) {
    border-color: var(--ds-primary);
    background: #fff7ed;
    font-weight: 600;
}
.ds-check-label input[type="checkbox"] {
    width: 20px; height: 20px;
    accent-color: var(--ds-primary);
    flex-shrink: 0;
}

/* ── アップロード ── */
.ds-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-bg);
    color: var(--ds-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    margin-top: 8px;
}
.ds-upload-btn:active { background: #fff7ed; border-color: var(--ds-primary); }
.ds-file-input { display: none; }
.ds-upload-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ds-preview-item {
    position: relative;
    background: var(--ds-white);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    overflow: hidden;
}
.ds-preview-img { width: 80px; height: 80px; object-fit: cover; display: block; }
.ds-preview-file {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--ds-text-muted);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ds-preview-remove {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px;
    background: var(--ds-danger); color: #fff;
    border: none; border-radius: 50%;
    font-size: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* ── エラー ── */
.ds-field-error {
    display: block;
    color: var(--ds-danger);
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px;
}
.ds-error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--ds-radius-sm);
    padding: 14px 16px;
    margin: 0 12px 12px;
    color: var(--ds-danger);
    font-size: 14px;
}

/* ── ボタン ── */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 24px;
    border-radius: var(--ds-radius-sm);
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.ds-btn-primary {
    background: var(--ds-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(249,115,22,.35);
}
.ds-btn-primary:active { background: var(--ds-primary-dk); transform: scale(.98); }
.ds-btn-secondary {
    background: var(--ds-white);
    color: var(--ds-text);
    border: 2px solid var(--ds-border);
}
.ds-btn-lg { width: 100%; padding: 18px; font-size: 17px; }
.ds-btn-sm { padding: 8px 16px; font-size: 13px; }
.ds-btn:disabled { opacity: .5; pointer-events: none; }
.ds-btn-area { padding: 8px 12px 24px; }
.ds-btn-row { display: flex; gap: 12px; }
.ds-btn-row .ds-btn { flex: 1; }

/* ── メール入力+ボタン横並び ── */
.ds-input-btn-row { display: flex; gap: 8px; align-items: center; }
.ds-input-btn-row .ds-input { flex: 1; }
.ds-test-mail-result { display: block; font-size: 13px; font-weight: 600; margin-top: 6px; }
.ds-test-ok { color: var(--ds-success); }
.ds-test-ng { color: var(--ds-danger); }

/* ── ヒントボックス ── */
.ds-hint-box {
    margin: 0 12px 12px;
    border-radius: var(--ds-radius);
    overflow: hidden;
    border: 1px solid var(--ds-border);
}
.ds-hint-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f1f5f9;
}
.ds-hint-img {
    width: calc(50% - 4px);
    border-radius: var(--ds-radius-sm);
    object-fit: cover;
    max-height: 200px;
}
.ds-hint-example,
.ds-hint-notice {
    padding: 14px 16px;
    background: var(--ds-white);
    border-top: 1px solid var(--ds-border);
}
.ds-hint-notice { background: #fffbeb; }
.ds-hint-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--ds-text-muted);
}
.ds-hint-example p,
.ds-hint-notice p { margin: 0 0 4px; font-size: 14px; }

/* ── 確認画面 ── */
.ds-confirm-note {
    color: var(--ds-text-muted);
    font-size: 14px;
    padding: 0 12px 12px;
}
.ds-confirm-table {
    margin: 0 12px 16px;
    background: var(--ds-white);
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-shadow);
    overflow: hidden;
}
.ds-confirm-section {
    padding: 10px 16px;
    background: var(--ds-bg);
    font-size: 13px;
    font-weight: 700;
    color: var(--ds-primary);
    border-bottom: 1px solid var(--ds-border);
}
.ds-confirm-row {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ds-border);
    gap: 12px;
}
.ds-confirm-row:last-child { border-bottom: none; }
.ds-confirm-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ds-text-muted);
    min-width: 120px;
    padding-top: 2px;
}
.ds-confirm-value { font-size: 14px; color: var(--ds-text); flex: 1; }

/* ── 完了画面 ── */
.ds-complete-wrap { text-align: center; padding: 60px 16px; }
.ds-complete-icon { font-size: 64px; margin-bottom: 16px; }
.ds-complete-msg {
    color: var(--ds-text-muted);
    font-size: 15px;
    margin: 12px 0 28px;
    line-height: 1.8;
}

/* ── ログインボックス ── */
.ds-login-box {
    background: var(--ds-white);
    border-radius: var(--ds-radius);
    padding: 32px 16px;
    margin: 40px 12px;
    box-shadow: var(--ds-shadow-lg);
}
.ds-login-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
    color: var(--ds-primary);
}

/* ── 進捗カード ── */
.ds-app-list { display: flex; flex-direction: column; gap: 16px; padding: 12px; }
.ds-app-card {
    background: var(--ds-white);
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-shadow);
    padding: 16px;
}
.ds-app-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.ds-app-shop-name { font-size: 16px; font-weight: 700; }
.ds-status-badge {
    font-size: 11px; font-weight: 700; color: #fff;
    padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.ds-app-card-meta {
    display: flex; gap: 12px;
    font-size: 12px; color: var(--ds-text-muted);
    margin-bottom: 14px;
}

/* ── タイムライン ── */
.ds-timeline { list-style: none; padding: 0; margin: 0 0 14px; }
.ds-timeline-item {
    display: flex; gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ds-border);
}
.ds-timeline-item:last-child { border-bottom: none; }
.ds-timeline-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.ds-timeline-body { flex: 1; }
.ds-timeline-author { font-size: 12px; font-weight: 700; margin-right: 8px; }
.ds-timeline-admin .ds-timeline-author { color: var(--ds-primary); }
.ds-timeline-sales .ds-timeline-author { color: var(--ds-secondary); }
.ds-timeline-date { font-size: 11px; color: var(--ds-text-muted); }
.ds-timeline-note { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.ds-no-progress { font-size: 13px; color: var(--ds-text-muted); padding: 8px 0; }

/* ── 進捗読み取り専用 ── */
.ds-progress-readonly {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--ds-bg);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    color: var(--ds-text-muted);
    font-size: 13px;
    text-align: center;
}

/* ── ローディングスピナー ── */
.ds-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 3px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ds-spin .7s linear infinite;
    vertical-align: middle;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ── トースト ── */
#ds-toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ds-text);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px; font-weight: 600;
    box-shadow: var(--ds-shadow-lg);
    z-index: 9999;
    transition: transform .3s ease;
    white-space: nowrap;
    pointer-events: none;
}
#ds-toast.ds-toast-show    { transform: translateX(-50%) translateY(0); }
#ds-toast.ds-toast-success { background: var(--ds-success); }
#ds-toast.ds-toast-error   { background: var(--ds-danger); }

/* ── その他 ── */
.ds-note { font-size: 13px; color: var(--ds-text-muted); }
.ds-empty-msg { text-align: center; padding: 60px 20px; color: var(--ds-text-muted); }

/* ── タブレット以上 ── */
@media (min-width: 640px) {
    .ds-field,
    .ds-error-box,
    .ds-hint-box,
    .ds-confirm-table,
    .ds-btn-area,
    .ds-login-box { margin-left: 24px; margin-right: 24px; }
    .ds-hint-img { width: calc(33.3% - 6px); }
    .ds-radio-group { flex-direction: row; flex-wrap: wrap; }
    .ds-radio-label { flex: 1; min-width: 200px; }
}