/**
 * フロントエンド CSS
 * 
 * @package AffiliateAdManager
 */

/* 広告コンテナのスタイル */
.aam-ad {
    position: relative;
    margin: 1em 0;
    overflow: hidden;
}

/* 広告の配置 */
.aam-ad.alignleft {
    float: left;
    margin: 0 1em 1em 0;
}

.aam-ad.alignright {
    float: right;
    margin: 0 0 1em 1em;
}

.aam-ad.aligncenter {
    display: block;
    margin: 1em auto;
    text-align: center;
}

/* トラッキング対象リンクのスタイル */
.aam-tracked-link {
    position: relative;
    transition: opacity 0.2s ease;
}

.aam-tracked-link:hover {
    opacity: 0.8;
}

/* ローディング状態 */
.aam-tracked-link.loading {
    pointer-events: none;
    opacity: 0.6;
}

.aam-tracked-link.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: aam-spin 1s linear infinite;
    z-index: 999;
}

@keyframes aam-spin {
    to {
        transform: rotate(360deg);
    }
}

/* エラー表示 */
.aam-error {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 14px;
}

.aam-error strong {
    font-weight: bold;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .aam-ad.alignleft,
    .aam-ad.alignright {
        float: none;
        margin: 1em 0;
        text-align: center;
    }
}

/* 広告コンテナの種類別スタイル */
.aam-ad-banner {
    text-align: center;
}

.aam-ad-sidebar {
    max-width: 300px;
}

.aam-ad-inline {
    display: inline-block;
    vertical-align: top;
}

/* アニメーション効果 */
.aam-ad.fade-in {
    animation: aamFadeIn 0.5s ease-in;
}

@keyframes aamFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aam-ad.slide-in {
    animation: aamSlideIn 0.5s ease-out;
}

@keyframes aamSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ホバーエフェクト */
.aam-ad-hover-lift:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

.aam-ad-hover-scale:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.aam-ad-hover-shadow:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

/* プリントメディア対応 */
@media print {
    .aam-ad {
        display: none !important;
    }
}

/* アクセシビリティ対応 */
.aam-ad:focus {
    outline: 2px solid #005cee;
    outline-offset: 2px;
}

.aam-tracked-link:focus {
    outline: 2px solid #005cee;
    outline-offset: 2px;
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .aam-error {
        background: #2d1b00;
        border-color: #4a3000;
        color: #ffdb9b;
    }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .aam-tracked-link {
        border: 1px solid;
    }
    
    .aam-error {
        border-width: 2px;
    }
}

/* アニメーション削減設定 */
@media (prefers-reduced-motion: reduce) {
    .aam-ad.fade-in,
    .aam-ad.slide-in,
    .aam-ad-hover-lift:hover,
    .aam-ad-hover-scale:hover,
    .aam-tracked-link {
        animation: none;
        transition: none;
        transform: none;
    }
}