/* 全体レイアウト */
.profile-container {
    margin-top: 100px;
    max-width: 1200px;
    margin: 100px auto 40px;
    padding: 30px;
    background-color: transparent;
    border: 2px solid #bababa;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: row;
    gap: 30px;
}

/* ヘッダー風の装飾 */
.profile-container::before {
    content: "勤務者情報";
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 4px;
    color: #718096;
    border-bottom: 1px solid #bababa;
    padding-bottom: 5px;
}

/* 左半分:立ち絵 */
.profile-image {
    max-width: 400px;
    width: 400px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: transparent;
    border: 3px solid #bababa;
    padding: 15px;
    position: relative;
}

.profile-image::before {
    content: "写真";
    position: absolute;
    top: -12px;
    left: 15px;
    background: #1a1d23;
    padding: 0 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #a0aec0;
}

.profile-image img {
    max-width: 100%;
    max-height: 600px;
    border: 1px solid #bababa;
}

/* 右半分 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* アイコンリストセクション */
.icon-list {
    background-color: transparent;
    border: 2px solid #bababa;
    padding: 15px;
    position: relative;
    overflow: hidden; /* ★追加: はみ出し防止 */
}

.icon-list::before {
    position: absolute;
    top: -12px;
    left: 15px;
    background: #1a1d23;
    padding: 0 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #a0aec0;
}

.icon-list ul {
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 8px;
    background-color: transparent;
    padding: 15px 10px 10px;
    justify-items: center;
    align-items: center;
    width: 100%; /* ★追加 */
    box-sizing: border-box; /* ★追加 */
}

/* アイコン枠 */
.icon-item {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    border: 2px solid #bababa;
    background-color: #1a1d23;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* アイコン画像 */
.icon-item img {
    width: 100%;
    height: 100%;
    cursor: pointer;
    filter: brightness(0.95);
}

.icon-item img:hover {
    filter: brightness(1.1);
}

/* 空のアイコン枠 */
.empty-icon {
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        #1a1d23 5px,
        #1a1d23 10px
    );
}

/* プロフィール本文セクション */
.profile-description {
    background-color: transparent;
    padding: 20px 25px;
    border: 2px solid #bababa;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    flex: 1;
    position: relative;
}

.profile-description::before {
    content: "詳細";
    position: absolute;
    top: -12px;
    left: 15px;
    background: #1a1d23;
    padding: 0 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #a0aec0;
}

/* FA許可ステータス */
.fa-permission-status {
    position: absolute;
    top: -12px;
    right: 15px;
    background: #1a1d23;
    padding: 0 10px;
    font-size: 11px;
}

.fa-permission-status p {
    margin: 0;
    color: #a0aec0;
    font-weight: bold;
    letter-spacing: 1px;
}

.fa-status-ok {
    color: #48bb78;
}

.fa-status-ng {
    color: #f56565;
}

.profile-description h2 {
    font-size: 18px;
    margin-bottom: 15px;
    margin-top: 10px;
    color: #e2e8f0;
    font-weight: bold;
    letter-spacing: 1px;
    border-bottom: 1px solid #bababa;
    padding-bottom: 8px;
}

.profile-description p,
.bio-content {
    font-size: 15px;
    line-height: 1.8;
    color: #cbd5e0;
    margin-bottom: 25px;
    font-family: 'SansM', sans-serif;
}

/* 日記アコーディオンセクション */
.diary-accordion-container {
    margin-top: 20px;
    border-top: 2px solid #bababa;
    padding-top: 15px;
}

/* アコーディオンヘッダー */
.accordion-header {
    display: block;
    cursor: pointer;
    background-color: transparent;
    padding: 12px 20px;
    border: 2px solid #bababa;
    user-select: none;
    transition: background-color 0.2s;
    position: relative;
    z-index: 10;
}

.accordion-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-header:hover {
    background-color: #374151;
}

.toggle-icon {
    font-size: 0.9em;
    margin-left: 10px;
    transition: transform 0.3s;
}

/* アコーディオン内容 */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background-color: #1a1d23;
    border: 2px solid #bababa;
    border-top: none;
    position: relative;
    z-index: 9;
}

.accordion-toggle:checked ~ .accordion-content {
    max-height: 2000px;
}

.accordion-toggle:checked + .accordion-header .toggle-icon {
    transform: rotate(180deg);
}

/* 日記リスト */
.diary-list {
    padding: 15px 20px;
    list-style: none;
    margin: 0;
}

.diary-item {
    padding: 10px 0;
    border-bottom: 1px dotted #bababa;
}

.diary-item:last-child {
    border-bottom: none;
}

.diary-item a {
    color: #a0aec0;
    text-decoration: none;
    font-size: 14px;
    display: block;
    transition: color 0.2s;
}

.diary-item a:hover {
    color: #7DF9FF;
}

.diary-title {
    font-weight: bold;
    color: #cbd5e0;
}

.diary-date {
    font-style: italic;
    color: #718096;
    font-size: 12px;
}

.no-diary {
    padding: 15px 20px;
    color: #718096;
    font-style: italic;
    text-align: center;
}

/* ★★★ レスポンシブ調整(大幅修正) ★★★ */
@media (max-width: 767px) {
    .profile-container {
        flex-direction: column;
        padding: 15px;
        margin-top: 80px;
        gap: 20px;
    }

    .profile-container::before {
        font-size: 11px;
        top: 70px;
        letter-spacing: 2px;
    }

    .profile-image {
        max-width: 100%;
        width: 100%;
    }

    /* ★アイコンリストのスマホ対応 */
    .icon-list {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .icon-list ul {
        grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); /* ★動的に列数を調整 */
        grid-auto-rows: 30px;
        gap: 5px;
        padding: 15px 5px 5px;
        max-width: 100%;
    }

    .icon-item {
        width: 100%; /* ★グリッドセルいっぱいに */
        height: 100%;
        max-width: 35px; /* ★最大サイズ制限 */
        max-height: 35px;
    }

    .profile-description {
        padding: 15px;
    }

    .profile-description h2 {
        font-size: 16px;
    }

    .fa-permission-status {
        position: static; /* ★スマホでは通常配置に */
        background: transparent;
        padding: 0;
        margin-bottom: 10px;
    }
}

/* ★★★ さらに小さい画面用 ★★★ */
@media (max-width: 400px) {
    .icon-list ul {
        grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
        grid-auto-rows: 28px;
        gap: 4px;
    }
    
    .icon-item {
        max-width: 30px;
        max-height: 30px;
    }
}