/* ==========================================================================
   1. リストディスクリプション設定
========================================================================== */

.ea-list-description {
    text-align: center;
    margin: 20px 0 0 0;
    font-size: 16px;
}

@media (max-width: 768px) {
    .ea-list-description {
        font-size: 14px;
        margin: 15px 10px 0 10px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .ea-list-description {
        font-size: 12px;
        margin: 10px 5px 0 5px;
    }
}

/* ==========================================================================
   2. EAリスト設定
========================================================================== */

.ea-list {
    padding: 0 40px 40px 40px;
    max-width: 1000px;
    margin: 0 auto;
    height: 80vh;
    overflow-y: auto;
    overflow-x: auto;
}

.ea-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ea-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.ea-table th {
    background-color: #f8f9fa;
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    color: #333;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    position: relative;
}

.ea-table th::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
    z-index: -1;
}

.ea-table td {
    padding: 8px;
    border: 1px solid #dee2e6;
    text-align: center;
    vertical-align: middle;
}

.ea-table tr:hover {
    background-color: #f5f5f5;
}

.ea-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ea-name {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.ea-name:hover {
    text-decoration: underline;
}

/* 数値データのスタイル */
.ea-metrics {
    font-family: 'Roboto Mono', monospace;
    color: #333;
}

/* テーブル行の基本高さを設定 */
.ea-table tr {
    height: 60px;
}

.ea-table td:first-child {
    width: 50px;
    height: 50px;
    padding: 4px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .ea-list {
        padding: 0 10px 20px 10px;
        height: auto;
        overflow-x: hidden;
    }

    .ea-table {
        font-size: 14px;
        table-layout: fixed;
        width: 100%;
    }
    
    /* 行の高さを調整 */
    .ea-table tr {
        height: 45px;  /* 60pxから45pxに変更 */
    }
    
    /* アイコンセルのサイズ調整 */
    .ea-table td:first-child {
        width: 50px;
        height: 40px;  /* 50pxから40pxに変更 */
        padding: 2px;  /* パディングを4pxから2pxに変更 */
    }
    
    /* 各列の幅を調整 */
    .ea-table th:nth-child(1),
    .ea-table td:nth-child(1) {
        width: 50px;
    }
    
    .ea-table th:nth-child(2),
    .ea-table td:nth-child(2) {
        width: 50%;  /* 40%から50%に増加 */
    }
    
    .ea-table th:nth-child(3),
    .ea-table td:nth-child(3),
    .ea-table th:nth-child(4),
    .ea-table td:nth-child(4) {
        width: calc((100% - 50px - 50% - 15%) / 2);  /* PFとRFの幅をさらに縮小 */
    }
    
    .ea-table th:nth-child(5),
    .ea-table td:nth-child(5) {
        width: 15%;  /* 最大DDの幅は固定 */
    }
    
    /* セル内の文字を調整 */
    .ea-table th,
    .ea-table td {
        padding: 8px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* アイコンのサイズ調整 */
    .ea-icon {
        width: 40px;
        height: 40px;
    }
    
    /* EA名のスタイル調整 */
    .ea-table td:nth-child(2) {
        text-align: left;
    }

    /* テーブルヘッダーの調整 */
    .ea-table th {
        font-size: 12px;
        padding: 6px 2px;
        line-height: 1.2;
    }

    /* インフォメーションアイコンの調整 */
    .info-icon i {
        font-size: 12px;
    }

    /* PF, RF, 最大DDのヘッダーテキストを調整 */
    .ea-table th:nth-child(3),
    .ea-table th:nth-child(4),
    .ea-table th:nth-child(5) {
        font-size: 11px;
        padding: 6px 1px;
    }

    .info-icon[data-tooltip]:before {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        width: 80%;
        max-width: 280px;
        background-color: rgba(0, 0, 0, 0.9);
        padding: 15px;
        font-size: 13px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        border-radius: 8px;
        z-index: 1000;
        color: white;
        visibility: hidden;
        opacity: 0;
    }

    /* オーバーレイの追加 */
    .info-icon[data-tooltip]::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 999;
    }

    /* ホバーではなくクリック時に表示 */
    .info-icon[data-tooltip].active::before,
    .info-icon[data-tooltip].active::after {
        visibility: visible;
        opacity: 1;
    }
}

/* さらに小さい画面サイズ向けの調整 */
@media (max-width: 480px) {
    .ea-list {
        padding: 0 5px 10px 5px;
    }
    
    .ea-table {
        font-size: 12px;
    }
    
    /* 行の高さをさらに調整 */
    .ea-table tr {
        height: 40px;  /* さらに小さく */
    }
    
    /* アイコンセルのサイズ調整 */
    .ea-table td:first-child {
        height: 35px;
        padding: 1px;
    }
    
    /* アイコン列をさらに小さく */
    .ea-table th:nth-child(1),
    .ea-table td:nth-child(1) {
        width: 40px;
    }
    
    .ea-icon {
        width: 35px;
        height: 35px;
    }
    
    /* EA名の列幅を調整 */
    .ea-table th:nth-child(2),
    .ea-table td:nth-child(2) {
        width: 30%;
    }
    
    /* 残りの列の幅を調整 */
    .ea-table th:nth-child(3),
    .ea-table td:nth-child(3),
    .ea-table th:nth-child(4),
    .ea-table td:nth-child(4) {
        width: calc((100% - 40px - 45% - 15%) / 2);  /* PFとRFの幅をさらに縮小 */
    }
    
    .ea-table th:nth-child(5),
    .ea-table td:nth-child(5) {
        width: 20%;  /* 最大DDの幅は固定 */
    }

    /* さらに小さい画面向けの調整 */
    .ea-table th {
        font-size: 11px;
        padding: 4px 1px;
    }

    .info-icon i {
        font-size: 11px;
    }
}

/* リンクのスタイル */
.ea-table a {
    color: #007bff;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    position: relative;
    padding: 2px 0;
    display: inline-block;
    cursor: pointer;
}

.ea-table a:hover {
    color: #0056b3;
    background-color: rgba(0, 123, 255, 0.1);
    border-radius: 3px;
}

/* アイコンリンクのスタイル */
.ea-table td a img {
    cursor: pointer;
}

/* アイコンホバー時のエフェクト */
.ea-table td a:hover .ea-icon {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* アイコンクリック時のエフェクト */
.ea-table td a:active .ea-icon {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* インフォメーションアイコンの基本スタイル */
.info-icon {
    color: #718096;
    font-size: 0.9em;
    margin-left: 0.3em;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.info-icon:hover {
    color: #4A5568;
}

/* テーブルセルの設定 */
.ea-table th,
.ea-table td {
    position: relative;
    overflow: visible !important;
}

/* ツールチップの基本スタイル */
.tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8em 1em;
    background-color: #2D3748;
    color: white;
    font-size: 0.8em;
    border-radius: 4px;
    z-index: 1000;
    font-family: sans-serif;
    font-weight: normal;
    width: max-content;
    max-width: 300px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: pre-line;
    line-height: 1.6;
    text-align: left;
}

/* 通常の三角形 */
.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #2D3748;
}

/* 最大DDのツールチップ特別スタイル */
.ea-table th:last-child .tooltip {
    top: calc(100% + 5px);
    left: auto;
    right: calc(100% - 10px);
    transform: none;
}

/* 最大DDの三角形位置調整 */
.ea-table th:last-child .tooltip::after {
    left: auto;
    right: -6px;
    bottom: auto;
    top: -6px;
    transform: rotate(-45deg);
    border: 6px solid transparent;
    border-bottom-color: #2D3748;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .info-icon {
        position: relative;
    }

    .tooltip {
        position: absolute;
        top: 25px;
        left: 50%;
        transform: translateX(-50%);
        max-width: 180px;
        font-size: 0.8em;
        white-space: pre-line;
        text-align: left;
        padding: 0.8em 1em;
        line-height: 1.5;
        width: max-content;
    }

    /* 最大DDのツールチップ位置調整 */
    .ea-table th:last-child .tooltip {
        left: auto;
        right: 0;
        transform: none;
    }
}

@media (max-width: 480px) {
    .tooltip {
        max-width: 140px;
        font-size: 0.8em;
        padding: 0.6em 0.8em;
        line-height: 1.4;
    }
}