/*
 * AWS SAP学習リソース - iam-access-analyzer-guide 専用CSS
 * ページ固有のレイアウト・セクション・コンポーネントスタイル
 *
 * WCAG 2.1 AA準拠版 - 2026-01-25
 */

/* ============================================
   CSS Variables - テキスト色の役割別定義
   ============================================ */
:root {
    /* テキスト色（WCAG AA準拠） */
    --text-heading: #1f2937;      /* 見出し: 白背景で 14.68:1 */
    --text-body: #374151;         /* 本文: 白背景で 9.86:1 */
    --text-muted: #4b5563;        /* 補助テキスト: 白背景で 7.21:1 */
    --text-caption: #6b7280;      /* キャプション: 白背景で 4.83:1 */

    /* 白背景上のアクセントテキスト */
    --text-accent-purple: #6d28d9;   /* 紫アクセント: 白で 7.59:1 */
    --text-accent-pink: #be185d;     /* ピンクアクセント: 白で 6.07:1 */
    --text-accent-green: #047857;    /* 緑アクセント: 白で 5.91:1 */
    --text-accent-blue: #1d4ed8;     /* 青アクセント: 白で 8.59:1 */
    --text-accent-orange: #c2410c;   /* オレンジアクセント: 白で 5.30:1 */

    /* 暗い背景上のテキスト（ヘッダー/バッジ用） */
    --text-on-dark: #ffffff;
    --text-on-dark-muted: #e5e7eb;

    /* 背景色 */
    --bg-card: #ffffff;
    --bg-card-subtle: #f9fafb;
    --bg-overlay: rgba(255, 255, 255, 0.95);

    /* ボーダー */
    --border-light: #e5e7eb;
    --border-accent: #8b5cf6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: var(--text-body);
    line-height: 1.8;
    padding-top: 80px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================
   ヘッダー - 暗い背景に白文字（装飾目的）
   ============================================ */
.header {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(236, 72, 153, 0.9));
    border-radius: 30px;
    margin-bottom: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.header-content {
    position: relative;
    z-index: 1;
}

.header-icon {
    font-size: 80px;
    margin-bottom: 20px;
    display: block;
}

.header h1 {
    font-size: 3em;
    color: var(--text-on-dark);
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-subtitle {
    font-size: 1.4em;
    color: var(--text-on-dark);
    margin-bottom: 20px;
}

.header-tagline {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1.1em;
    color: var(--text-on-dark);
    backdrop-filter: blur(10px);
}

/* ============================================
   セクション共通 - 白背景カードベース
   ============================================ */
.section {
    margin-bottom: 50px;
}

/* 通常セクション見出し - 白/淡色背景上で使用 */
.section-title {
    font-size: 2em;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-heading);
    background: var(--bg-overlay);
    padding: 15px 25px;
    border-radius: 15px;
    border-left: 5px solid #8b5cf6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.section-title-icon {
    font-size: 1.2em;
}

/* ヒーローエリア用見出し - 暗い背景上で使用（必要に応じて適用） */
.section-title--hero {
    color: var(--text-on-dark);
    background: transparent;
    padding: 0;
    border-left: none;
    box-shadow: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ============================================
   汎用カード - 白背景で高コントラスト
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
    border-color: var(--border-accent);
}

/* ============================================
   たとえ話セクション
   ============================================ */
.analogy-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .analogy-container {
        grid-template-columns: 1fr;
    }
}

.analogy-card {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 35px;
    border: 2px solid var(--border-light);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.analogy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899, #8b5cf6);
}

.analogy-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.analogy-icon {
    font-size: 50px;
}

.analogy-title {
    font-size: 1.5em;
    color: var(--text-heading);
}

.analogy-label {
    background: #f3e8ff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--text-accent-purple);
    font-weight: 600;
}

.analogy-description {
    font-size: 1.1em;
    color: var(--text-body);
    margin-bottom: 20px;
}

.analogy-points {
    list-style: none;
}

.analogy-points li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-body);
}

.analogy-points li:last-child {
    border-bottom: none;
}

.point-icon {
    font-size: 1.3em;
    flex-shrink: 0;
}

/* 比較矢印 */
.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.arrow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.arrow-icon {
    font-size: 40px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.arrow-text {
    font-size: 0.9em;
    color: var(--text-on-dark);
}

/* ============================================
   仕組み説明
   ============================================ */
.how-it-works {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 40px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.flow-diagram {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.flow-step {
    text-align: center;
    min-width: 150px;
}

.flow-step-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 15px;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.flow-step:hover .flow-step-icon {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.5);
}

.flow-step-label {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.flow-step-name {
    font-size: 1.1em;
    color: var(--text-accent-purple);
    font-weight: bold;
}

.flow-arrow {
    font-size: 30px;
    color: #8b5cf6;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   分析対象リソース
   ============================================ */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.resource-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.resource-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--resource-color, #8b5cf6), transparent);
}

.resource-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--border-accent);
}

.resource-icon {
    font-size: 50px;
    margin-bottom: 15px;
}

.resource-name {
    font-size: 1.2em;
    color: var(--text-heading);
    font-weight: bold;
    margin-bottom: 10px;
}

.resource-desc {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* ============================================
   検出タイプ
   ============================================ */
.finding-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.finding-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    border-left: 5px solid;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.finding-card.critical {
    border-left-color: #dc2626;
}

.finding-card.warning {
    border-left-color: #d97706;
}

.finding-card.info {
    border-left-color: #2563eb;
}

.finding-card:hover {
    transform: translateX(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.finding-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.finding-icon {
    font-size: 35px;
}

.finding-title {
    font-size: 1.2em;
    color: var(--text-heading);
}

.finding-severity {
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 0.75em;
    font-weight: bold;
}

.finding-severity.critical {
    background: #fef2f2;
    color: #991b1b;
}

.finding-severity.warning {
    background: #fffbeb;
    color: #92400e;
}

.finding-severity.info {
    background: #eff6ff;
    color: #1e40af;
}

/* finding-cardの本文テキスト色を修正 */
.finding-card p {
    color: var(--text-body);
}

/* ============================================
   アナライザータイプ
   ============================================ */
.analyzer-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.analyzer-card {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 35px;
    border: 2px solid var(--border-light);
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.analyzer-badge {
    position: absolute;
    top: -15px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    color: var(--text-on-dark);
}

.analyzer-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.analyzer-icon {
    font-size: 45px;
}

.analyzer-title {
    font-size: 1.4em;
    color: var(--text-heading);
}

.analyzer-scope {
    background: #ecfdf5;
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.analyzer-scope-label {
    font-size: 0.85em;
    color: var(--text-accent-green);
    font-weight: 600;
    margin-bottom: 5px;
}

.analyzer-scope-value {
    font-size: 1.1em;
    color: var(--text-body);
}

/* analyzer-cardの本文テキスト色を修正 */
.analyzer-card > p {
    color: var(--text-body);
    margin-bottom: 15px;
}

.analyzer-use-cases {
    list-style: none;
}

.analyzer-use-cases li {
    padding: 10px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
}

.analyzer-use-cases li:last-child {
    border-bottom: none;
}

/* ============================================
   ビジュアル説明図
   ============================================ */
.visual-diagram {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 40px;
    margin: 30px 0;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.diagram-title {
    text-align: center;
    font-size: 1.5em;
    color: var(--text-heading);
    margin-bottom: 30px;
}

.zone-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    flex-wrap: wrap;
}

.trust-zone {
    padding: 30px;
    border-radius: 20px;
    min-width: 280px;
    flex: 1;
}

.zone-internal {
    background: #ecfdf5;
    border: 2px solid #86efac;
}

.zone-external {
    background: #fef2f2;
    border: 2px solid #fca5a5;
}

.zone-boundary {
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #8b5cf6, #ec4899);
    padding: 20px 10px;
}

.boundary-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.boundary-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.9em;
    color: var(--text-on-dark);
    font-weight: 600;
}

.zone-title {
    text-align: center;
    font-size: 1.3em;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
}

.zone-internal .zone-title {
    background: #d1fae5;
    color: #065f46;
}

.zone-external .zone-title {
    background: #fee2e2;
    color: #991b1b;
}

.zone-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.zone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    color: var(--text-body);
}

.zone-item-icon {
    font-size: 28px;
}

/* ============================================
   使い方セクション
   ============================================ */
.usage-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.usage-step {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    position: relative;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.step-number {
    position: absolute;
    top: -15px;
    left: 25px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-on-dark);
}

.step-title {
    font-size: 1.2em;
    color: var(--text-heading);
    margin: 15px 0;
}

.step-description {
    color: var(--text-body);
    margin-bottom: 15px;
}

/* ============================================
   コード
   ============================================ */
.code-block {
    background: #1e1e2e;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    border: 1px solid #313244;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #313244;
}

.code-title {
    color: #cdd6f4;
    font-size: 0.9em;
}

.code-copy {
    background: #45475a;
    border: none;
    padding: 5px 15px;
    border-radius: 8px;
    color: #cdd6f4;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.code-copy:hover {
    background: #585b70;
}

pre {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    color: #cdd6f4;
    margin: 0;
}

.code-comment {
    color: #6c7086;
}

.code-keyword {
    color: #cba6f7;
}

.code-string {
    color: #a6e3a1;
}

.code-value {
    color: #f9e2af;
}

/* ============================================
   ベストプラクティス
   ============================================ */
.best-practices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.practice-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.practice-card:hover {
    border-color: #10b981;
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.1);
}

.practice-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.practice-title {
    font-size: 1.15em;
    color: var(--text-heading);
    margin-bottom: 10px;
}

.practice-desc {
    color: var(--text-body);
    font-size: 0.95em;
}

/* ============================================
   料金
   ============================================ */
.pricing-card {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 40px;
    border: 1px solid var(--border-light);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.pricing-highlight {
    font-size: 3em;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    margin-bottom: 20px;
}

.pricing-note {
    color: var(--text-body);
    font-size: 1.1em;
    margin-bottom: 25px;
}

.pricing-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.pricing-item {
    background: var(--bg-card-subtle);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--border-light);
}

.pricing-item-title {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.pricing-item-value {
    color: var(--text-heading);
    font-size: 1.1em;
    font-weight: 600;
}

/* ============================================
   FAQ
   ============================================ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.faq-item {
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.faq-question {
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    color: var(--text-heading);
    transition: background 0.3s ease;
}

.faq-question:hover {
    background: var(--bg-card-subtle);
}

.faq-toggle {
    font-size: 1.3em;
    transition: transform 0.3s ease;
    color: var(--text-accent-purple);
}

.faq-item.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 0 25px 20px;
    max-height: 500px;
}

.faq-answer p {
    color: var(--text-body);
}

/* ============================================
   まとめ
   ============================================ */
.summary-card {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 40px;
    border: 2px solid var(--border-light);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.summary-title {
    font-size: 1.8em;
    color: var(--text-heading);
    margin-bottom: 30px;
}

.summary-points {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    text-align: left;
}

.summary-point {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: var(--bg-card-subtle);
    border-radius: 15px;
    border: 1px solid var(--border-light);
}

.summary-icon {
    font-size: 30px;
    flex-shrink: 0;
}

.summary-text {
    color: var(--text-body);
}

/* ============================================
   フッター
   ============================================ */
.footer {
    text-align: center;
    padding: 40px;
    color: var(--text-on-dark-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 50px;
}

/* ============================================
   レスポンシブ
   ============================================ */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .section-title {
        font-size: 1.5em;
        padding: 12px 18px;
    }

    .zone-container {
        flex-direction: column;
    }

    .zone-boundary {
        width: 100%;
        flex-direction: row;
        height: 50px;
    }

    .boundary-text {
        writing-mode: horizontal-tb;
    }

    .flow-diagram {
        flex-direction: column;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }
}
