/**
 * Affiliate System - フロントエンドCSS
 * アフィリエイターダッシュボード用
 */

/* ダッシュボードコンテナ */
.affiliate-dashboard {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ヘッダー */
.affiliate-dashboard-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #667eea;
}

.affiliate-dashboard-header h2 {
    font-size: 28px;
    color: #333;
    margin: 0 0 10px;
}

.affiliate-welcome {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* ウェルカムメッセージ */
.affiliate-welcome-message {
    text-align: left;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px 25px;
    margin-top: 20px;
    line-height: 1.8;
}

.affiliate-welcome-message p {
    margin: 0 0 10px;
    color: #555;
    font-size: 14px;
}

.affiliate-welcome-message p:last-child {
    margin-bottom: 0;
}

.affiliate-welcome-message a {
    color: #667eea;
    text-decoration: none;
}

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

/* 報酬対象についてのお知らせボックス */
.affiliate-notice-box {
    margin-top: 20px;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #667eea;
    border-radius: 0 8px 8px 0;
}

.affiliate-notice-box h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #333;
}

.affiliate-notice-box ul {
    margin: 0;
    padding-left: 20px;
}

.affiliate-notice-box li {
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.affiliate-notice-box li:last-child {
    margin-bottom: 0;
}

/* 統計カード */
.affiliate-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.stat-card.highlight .stat-label,
.stat-card.highlight .stat-value {
    color: #fff;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

/* クーポンコードセクション */
.affiliate-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.affiliate-section h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: #333;
}

.coupon-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.coupon-code {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1px;
}

.coupon-info {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* クーポン価格情報 */
.coupon-price-info {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.coupon-price-info:first-of-type {
    margin-top: 25px;
}

.coupon-price-info + .coupon-price-info {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e0e0e0;
}

.coupon-price-info h4 {
    margin: 0 0 15px;
    font-size: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.coupon-code-label {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.coupon-price-table {
    font-size: 13px;
}

.coupon-price-table th {
    background: #f0f2f5;
    font-size: 12px;
}

.coupon-price-table td {
    vertical-align: middle;
}

.coupon-price-table td:nth-child(2) {
    color: #999;
    text-decoration: line-through;
}

.coupon-price-table td:nth-child(3) {
    color: #e74c3c;
}

.coupon-price-table .commission {
    background: rgba(102, 126, 234, 0.08);
}

.coupon-price-table .commission .rate-label {
    font-size: 11px;
    color: #999;
    margin-left: 4px;
}

/* 特別報酬レベル */
.special-level-row {
    background: #fffbf0;
}

.special-commission {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.special-level-note {
    margin-top: 12px;
    padding: 10px 15px;
    background: #fffbf0;
    border: 1px solid #ffe0a0;
    border-radius: 6px;
    font-size: 12px;
    color: #856404;
}

/* タブナビゲーション */
.affiliate-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 0;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 15px 25px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

/* タブコンテンツ */
.tab-content {
    display: none;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 25px;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    margin: 0 0 20px;
    font-size: 18px;
    color: #333;
}

/* テーブルスタイル */
.sales-table-wrapper {
    overflow-x: auto;
}

.affiliate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.affiliate-table th,
.affiliate-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.affiliate-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.affiliate-table tbody tr:hover {
    background: #f8f9fa;
}

.affiliate-table .commission {
    color: #667eea;
    font-weight: 600;
}

/* データなし */
.no-data {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

/* プロフィールフォーム */
.affiliate-profile-form {
    max-width: 600px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h4 {
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 16px;
    color: #333;
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* ボタン */
.affiliate-button {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.affiliate-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.affiliate-button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 通知 */
.affiliate-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.affiliate-notice.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.affiliate-notice.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* エラー・認証メッセージ */
.affiliate-login-required,
.affiliate-not-registered,
.affiliate-error {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
}

/* セクション説明文 */
.section-description {
    margin: -10px 0 20px;
    font-size: 13px;
    color: #666;
}

/* トグルスイッチ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
    z-index: 1;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* 自動返信フィールド */
.auto-reply-fields textarea {
    min-height: 150px;
}

/* レベル別自動返信セクション */
.auto-reply-level-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.auto-reply-level-section:last-of-type {
    margin-bottom: 0;
}

.level-toggle-row {
    margin-bottom: 0;
}

.level-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}

.level-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #667eea;
}

.level-checkbox-text {
    font-size: 15px;
    color: #333;
}

.level-fields {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

.level-fields .form-row {
    margin-bottom: 15px;
}

.level-fields .form-row:last-child {
    margin-bottom: 0;
}

.level-fields textarea {
    min-height: 120px;
}

/* レスポンシブ */
@media screen and (max-width: 768px) {
    .affiliate-dashboard {
        padding: 15px;
    }
    
    .affiliate-stats {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px 15px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .affiliate-tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .affiliate-table th,
    .affiliate-table td {
        padding: 10px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .affiliate-stats {
        grid-template-columns: 1fr;
    }
    
    .coupon-code {
        padding: 8px 15px;
        font-size: 13px;
    }
}

