/* =============================================================================
   追跡ページ専用スタイル
   ============================================================================= */

/* 追跡セクション */
.tracking-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #f1f8e9, #e8f5e8);
    min-height: 70vh;
}

/* 追跡フォーム */
.tracking-form {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    margin-bottom: 40px;
}

.tracking-form h2 {
    color: #2d5a3d;
    margin-bottom: 10px;
    font-size: 1.8em;
}

.format-hint {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 30px;
}

/* 追跡入力グループ */
.tracking-input-group {
    display: flex;
    gap: 15px;
    align-items: stretch;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.input-with-prefix {
    display: flex;
    align-items: stretch;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    overflow: hidden;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.input-with-prefix:focus-within {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}

.input-prefix {
    background: #f5f5f5;
    padding: 15px 20px;
    font-weight: bold;
    color: #2d5a3d;
    border-right: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
}

.tracking-input {
    border: none;
    padding: 15px 20px;
    font-size: 16px;
    outline: none;
    flex: 1;
    background: transparent;
    color: #333;
}

.tracking-input::placeholder {
    color: #999;
}

/* iOS Safari:ボタン反転抑止(trackingページ限定) */
.tracking-section .btn,
.tracking-section button {
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.tracking-section .btn:active,
.tracking-section button:active {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
    transform: translateY(0) !important;
    filter: none !important;
}

/* ボタン内スピナー制御 */
.btn--loading {
    pointer-events: none;
}

/* 追跡オプション */
.tracking-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn-option {
    background: white;
    color: #2d5a3d;
    border: 2px solid #e0e0e0;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.btn-option:hover {
    border-color: #4caf50;
    color: #4caf50;
}

.btn-option.active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

/* 追跡結果 */
.tracking-result {
    display: none;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    position: relative;
}

.tracking-result.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.tracking-header {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tracking-header h3 {
    color: white;
    margin: 0;
    font-size: 0.9em;
    line-height: 1.3;
    white-space: nowrap;
}

.tracking-id {
    font-size: 0.8em;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    word-break: keep-all;
}

/* 追跡情報グリッド */
.tracking-info {
    padding: 20px;
}

.tracking-summary {
    font-size: 0.95em;
    color: #333;
    line-height: 1.6;
}

.tracking-summary .line-top,
.tracking-summary .line-bottom {
    display: block;
}

.tracking-summary .line-bottom {
  margin-left: 0;
}

/* ローディングメッセージ */
.loading-message {
    font-size: 0.95em;
    color: #666;
    line-height: 1.6;
}

/* 凡例カード */
.status-legend {
    max-width: 800px;
    margin: 0 auto 60px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    padding: 20px 24px;
}

.status-legend h4 {
    color: #2d5a3d;
    margin-bottom: 14px;
    font-size: 1.1em;
}

.status-legend .legend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: max-content calc(2em + 1em) 1fr;
    row-gap: 10px;
    align-items: baseline;
}

.status-legend .legend-list li {
    display: contents;
}

.status-legend .legend-list strong {
    grid-column: 1;
    min-width: 0;
    white-space: nowrap;
    color: #333;
}

.status-legend .legend-sep {
    grid-column: 2;
    justify-self: start;
    text-align: center;
    white-space: nowrap;
    width: 3em;
    padding: 0;
}

.status-legend .legend-list li > span:last-child {
    grid-column: 3;
    min-width: 0;
    line-height: 1.7;
    color: #333;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item .label {
    color: #666;
    font-weight: 500;
}

.info-item .value {
    color: #333;
    font-weight: 600;
    text-align: right;
}

/* ステータスバッジ */
.value.status {
    padding: 6px 12px;
    border-radius: 15px;
    color: white;
    font-size: 0.9em;
}

.value.status.pending {
    background: #ff9800;
}

.value.status.in-transit {
    background: #2196f3;
}

.value.status.delivered {
    background: #4caf50;
}

.value.status.cancelled {
    background: #f44336;
}

.value.status.unknown {
    background: #9e9e9e;
}

/* タイムライン */
.tracking-timeline {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
}

.tracking-timeline h4 {
    color: #2d5a3d;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.timeline {
    position: relative;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #e0e0e0;
    margin-right: 20px;
    margin-top: 3px;
    flex-shrink: 0;
}

.timeline-marker.active {
    background: #4caf50;
    box-shadow: 0 0 0 2px #4caf50;
}

.timeline-content {
    flex: 1;
}

.timeline-date {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.timeline-status {
    color: #2d5a3d;
    font-weight: 600;
    margin-bottom: 5px;
}

.timeline-description {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

/* エラー表示 */
.error-message {
    max-width: 600px;
    margin: 0 auto;
    background: #fff5f5;
    border: 2px solid #ffcdd2;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    margin-bottom: 40px;
}

.error-message h3 {
    color: #d32f2f;
    margin-bottom: 12px;
    font-size: 1.2em;
}

.error-message p {
    color: #d32f2f;
    font-size: 1em;
    margin-bottom: 16px;
    font-weight: 600;
}

.error-message div {
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

.error-message a {
    color: #4caf50;
    text-decoration: none;
}

.error-message a:hover {
    text-decoration: underline;
}

/* エラーボックス */
#tracking-error {
    display: none;
}

#tracking-error.show {
    display: block;
}

/* 追跡履歴セクション */
.tracking-history-section {
    max-width: 800px;
    margin: 0 auto;
}

#tracking-history {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
}

.tracking-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
}

.tracking-history-header h4 {
    color: #2d5a3d;
    margin: 0;
}

.clear-history-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
}

.clear-history-btn:hover {
    color: #d32f2f;
}

.history-list {
    padding: 16px 24px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tracking-number {
    color: #2d5a3d;
    font-weight: 600;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timestamp {
    color: #666;
    font-size: 0.9em;
}

.retrack-btn {
    background: none;
    border: none;
    color: #4caf50;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
}

.retrack-btn:hover {
    color: #45a049;
}

.no-history {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-style: italic;
}

/* ローディング状態 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

/* レスポンシブデザイン(responsive.cssのブレークポイントに準拠) */
@media (max-width: 768px) {
    .tracking-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .input-with-prefix {
        min-width: auto;
        max-width: none;
    }
    
    .tracking-input-group .btn {
        align-self: center;
        width: auto;
        min-width: 200px;
    }
    
    .tracking-header {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .tracking-header h3 {
        font-size: 0.85em;
        line-height: 1.3;
    }
    
    .tracking-id {
        font-size: 0.75em;
        padding: 4px 10px;
    }

    .tracking-info {
        padding: 16px;
    }

    .tracking-summary {
        font-size: 0.9em;
        line-height: 1.5;
    }

    .loading-message {
        font-size: 0.9em;
        line-height: 1.5;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-item .value {
        text-align: left;
    }
    
    .timeline-item {
        margin-bottom: 20px;
    }
    
    .timeline-marker {
        margin-right: 15px;
    }
}

/* 決済待ち用スタイル */
.tracking-payment-note {
  background: #fff9c4;
  border-left: 4px solid #fbc02d;
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 4px;
}

.tracking-payment-note p {
  margin: 0;
  line-height: 1.6;
}

.tracking-payment-note p + p {
  margin-top: 8px;
}

.tracking-payment-note strong {
  color: #f57f17;
  font-size: 1.1em;
}
