/* TGT eSIM Checker Styles - Version 3.0 */

.tgt-esim-checker-container {
    max-width: 800px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.tgt-esim-checker-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.tgt-esim-checker-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
}

.tgt-esim-checker-form {
    margin-bottom: 1.5rem;
}

.tgt-form-group {
    margin-bottom: 1.5rem;
}

.tgt-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.tgt-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tgt-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.tgt-help-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.tgt-button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tgt-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #0052a3 0%, #003d7a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.tgt-button:active:not(:disabled) {
    transform: translateY(0);
}

.tgt-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tgt-button .button-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.tgt-result-container {
    animation: fadeIn 0.4s ease;
}

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

.tgt-result-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
}

.result-header h4 {
    margin: 0;
    font-size: 1.25rem;
    color: #1a1a1a;
}

.status-badge {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.activated {
    background: #cce5ff;
    color: #004085;
}

.status-badge.not-started {
    background: #fff3cd;
    color: #856404;
}

.status-badge.activation-expired {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.status-badge.cancelled {
    background: #e2e3e5;
    color: #383d41;
    border: 2px solid #6c757d;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* 新しいレイアウト: セクション構造 */
.result-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.result-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* データ使用状況グリッド */
.data-usage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.usage-item {
    text-align: center;
}

.usage-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.usage-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.value-number {
    font-size: inherit;
}

.value-unit {
    font-size: 1.125rem;
    color: #6c757d;
    margin-left: 0.25rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 5px;
    transition: width 0.6s ease;
}

.progress-fill.low {
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
}

.progress-fill.critical {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
}

.progress-fill.error {
    background: repeating-linear-gradient(
        45deg,
        #dc3545,
        #dc3545 10px,
        #c82333 10px,
        #c82333 20px
    );
    animation: error-stripe 1s linear infinite;
}

@keyframes error-stripe {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

/* 利用期間情報 */
.period-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.info-row.highlight {
    background: #fff3cd;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #ffc107;
    margin-top: 0.5rem;
    align-items: center;
}

.info-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    flex-shrink: 0;
}

.info-row.highlight .info-label {
    color: #856404;
    font-weight: 600;
}

.info-value {
    font-size: 0.95rem;
    color: #1a1a1a;
    font-weight: 600;
    text-align: right;
}

/* インストール状態バッジ */
.install-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.install-badge.installed {
    background: #d4edda;
    color: #155724;
}

.install-badge.installed-disabled {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.install-badge.deleted {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.install-badge.not-installed {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.info-value-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.info-value-sub {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
    text-align: right;
}

.info-row.highlight .info-value {
    color: #856404;
    font-size: 1.1rem;
}

/* タイムゾーン注釈 */
.timezone-note {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #0066cc;
    font-size: 0.85rem;
    color: #495057;
    line-height: 1.6;
}

.timezone-note a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
}

.timezone-note a:hover {
    text-decoration: underline;
}

/* 1日基準の注釈 */
.day-type-note {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #e7f3ff;
    border-radius: 6px;
    border-left: 3px solid #2196f3;
    font-size: 0.85rem;
    color: #0d47a1;
    font-weight: 600;
    text-align: center;
}

/* データ使用量の注釈 */
.data-note {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff3cd;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #856404;
    text-align: center;
    border: 1px solid #ffeaa7;
}

.data-note.error-note {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    font-weight: 600;
}

/* ICCID表示 */
.iccid-display {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: #495057;
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    word-break: break-all;
    text-align: center;
    border: 1px solid #e9ecef;
}

/* エラー表示 */
.tgt-error-container {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.error-icon {
    font-size: 1.5rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .tgt-esim-checker-card {
        padding: 1.5rem;
    }
    
    .data-usage-grid {
        grid-template-columns: 1fr;
    }
    
    .usage-value {
        font-size: 1.5rem;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .info-value-group {
        align-items: flex-start;
        width: 100%;
    }
    
    .info-value,
    .info-value-sub {
        text-align: left;
        font-size: 0.9rem;
    }
    
    .info-row.highlight {
        align-items: flex-start;
    }
    
    .info-row.highlight .info-value {
        font-size: 1rem;
    }
    
    .timezone-note {
        font-size: 0.8rem;
    }
    
    /* 日本語スマホ版: 日付を1行に収める（info-value-groupの中の日付のみ） */
    html[lang^="ja"] .info-value-group .info-value,
    html[lang="ja-JP"] .info-value-group .info-value {
        font-size: 0.85rem;
        word-break: keep-all;
        white-space: nowrap;
        overflow-wrap: normal;
    }
    
    /* 日本語スマホ版: UTC+0の日付も小さく */
    html[lang^="ja"] .info-value-sub,
    html[lang="ja-JP"] .info-value-sub {
        font-size: 0.75rem;
    }
    
    /* 日本語スマホ版: 1日の基準ラベルの改行調整 */
    html[lang^="ja"] .day-type-note,
    html[lang="ja-JP"] .day-type-note {
        word-break: keep-all;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.6;
    }
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
    .tgt-esim-checker-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .tgt-esim-checker-title,
    .result-header h4,
    .section-title,
    .usage-value,
    .info-value {
        color: #f7fafc;
    }
    
    .tgt-input {
        background: #1a202c;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .tgt-result-card {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .result-section {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .usage-label,
    .info-label {
        color: #a0aec0;
    }
    
    .iccid-display {
        background: #1a202c;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .info-row {
        border-bottom-color: #4a5568;
    }
    
    .info-row.highlight {
        background: #3a3420;
        border-color: #d69e2e;
    }
    
    .info-row.highlight .info-label,
    .info-row.highlight .info-value {
        color: #f6e05e;
    }
    
    .status-badge.active {
        background: #1e4620;
        color: #9ae6b4;
    }
    
    .status-badge.activated {
        background: #1e3a5f;
        color: #90cdf4;
    }
    
    .status-badge.not-started {
        background: #3a3420;
        color: #f6e05e;
    }
    
    .status-badge.activation-expired,
    .status-badge.inactive {
        background: #4a1c1c;
        color: #fc8181;
        border-color: #c53030;
    }
    
    .status-badge.cancelled {
        background: #2d3748;
        color: #a0aec0;
        border-color: #718096;
    }
    
    .install-badge.installed {
        background: #1e4620;
        color: #9ae6b4;
    }
    
    .install-badge.installed-disabled {
        background: #3a3420;
        color: #f6e05e;
        border-color: #d69e2e;
    }
    
    .install-badge.deleted {
        background: #4a1c1c;
        color: #fc8181;
        border-color: #c53030;
    }
    
    .install-badge.not-installed {
        background: #2d3748;
        color: #a0aec0;
        border-color: #4a5568;
    }
    
    .data-note {
        background: #3a3420;
        border-color: #d69e2e;
        color: #f6e05e;
    }
    
    .data-note.error-note {
        background: #5a1a1a;
        border-color: #dc3545;
        color: #f8d7da;
    }
    
    .timezone-note {
        background: #1a202c;
        border-color: #4299e1;
        color: #a0aec0;
    }
    
    .timezone-note a {
        color: #63b3ed;
    }
    
    .day-type-note {
        background: #1e3a5f;
        border-color: #4299e1;
        color: #90cdf4;
    }
}
