/* ===== リセット & ベーススタイル ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* body がサイドバーアクティブ時の制御 */
body.sidebar-active {
    overflow: hidden;
}

@media (max-width: 768px) {
    body.sidebar-active {
        position: fixed;
        width: 100%;
    }
}

/* ===== 表示制御用クラス ===== */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* ===== ログイン画面スタイル ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: #fff;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 0;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    background: #0091da;
    color: white;
    text-align: center;
    padding: 30px 20px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.login-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.login-form {
    padding: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group input[type="text"],
.input-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

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

.checkbox-group {
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.login-button {
    width: 100%;
    background: #0091da;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 20px 30px;
    border-left: 4px solid #c33;
    font-size: 14px;
}

.login-footer {
    background: #f8f9fa;
    padding: 15px 30px;
    text-align: center;
    color: #666;
}

/* ===== ポータル基本構造 ===== */
.portal-container {
    min-height: 100vh;
}

/* ===== ヘッダー ===== */
.portal-header {
    background: #0091da;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #e9ecef;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    gap: 15px;
}

/* サイトタイトル */
.site-title {
    color: #333;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    flex-shrink: 0;
    text-align: left;
}

.site-title a {
    color: #ffffff;
    text-decoration: none;
}

/* デスクトップ検索 */
.search-section.desktop-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-form {
    display: flex;
    background: #f8f9fa;
    border-radius: 25px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.search-form:focus-within {
    border-color: #667eea;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
}

.search-input::placeholder {
    color: #6c757d;
}

.search-button {
    background: #0091da;
    border: none;
    color: white;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: #4daad9;
}

/* デスクトップユーザーセクション */
.desktop-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.welcome-text {
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.logout-link {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.logout-link:hover {
    background: #c82333;
}

/* モバイルアイコン */
.mobile-icons {
    display: none;
    gap: 20px;
    align-items: center;
    margin-left: auto;
}

.mobile-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    gap: 4px;
    min-width: 50px;
    transition: background 0.3s ease;
    border-radius: 8px;
    color: #fff;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.mobile-icon-btn:active {
    background: rgba(0, 0, 0, 0.1);
    opacity: 0.7;
}

.icon-label {
    font-size: 10px;
    color: #fff;
    font-weight: 500;
    line-height: 1;
    margin-top: 2px;
}

.mobile-search-btn i {
    font-size: 18px;
    color: #fff;
}

/* ハンバーガーメニュー */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 18px;
}

.hamburger span {
    width: 100%;
    height: 2px;
    background: #fff;
    transition: 0.3s;
    border-radius: 1px;
}

.mobile-menu-btn.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* モバイル検索フォーム */
.mobile-search-form {
    display: none;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.mobile-search-form.show {
    display: block;
    animation: slideDown 0.3s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== レイアウト構造 ===== */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 30px;
    padding: 30px 20px;
    min-height: calc(100vh - 80px);
}

/* ===== デスクトップサイドバー ===== */
.desktop-sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px 0;
    height: fit-content;
    position: sticky;
    top: 110px;
}

.desktop-sidebar .sidebar-nav h3 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin: 0 20px 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f8f9fa;
}

/* ===== モバイルサイドバー ===== */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: 300px;
    height: 100%;
    background: white;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar-overlay.show .mobile-sidebar {
    transform: translateX(0);
}

.mobile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.mobile-sidebar-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.close-sidebar-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.close-sidebar-btn:hover {
    background: #e9ecef;
}

/* モバイルユーザー情報 */
.mobile-user-info {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #0091da;
    color: white;
    gap: 15px;
    flex-shrink: 0;
}

.user-avatar {
    font-size: 40px;
    color: rgba(255, 255, 255, 0.9);
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}

/* ナビゲーション共通 */
.nav-section {
    flex: 1;
    padding: 20px 0;
}

.nav-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin: 0 0 15px 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: #6c757d;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: #f8f9fa;
    color: #333;
}

.nav-item.active a {
    background: #f8f9fa;
    color: #667eea;
    border-left-color: #667eea;
}

.nav-item a i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

/* モバイルログアウト */
.mobile-logout-section {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.mobile-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
    justify-content: center;
}

.mobile-logout-btn:hover {
    background: #c82333;
}

/* ===== メインコンテンツ ===== */
.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 30px;
    min-height: 500px;
}

.content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f8f9fa;
}

.content-header h2 {
    color: #333;
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

/* ===== 投稿カードグリッド ===== */
.posts-grid {
    display: grid;
    /*grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));*/
    grid-template-columns: 1fr;
    gap: 20px;
}

.post-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
	margin-bottom: 10px;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    cursor: pointer;
}

.card-content {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /*min-height: 160px;*/
    position: relative;
}

.card-header-new {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.file-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.file-icon i {
    font-size: 24px;
}

.title-section {
    flex: 1;
    min-width: 0;
}

.card-title-new {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.file-type-display {
    color: #495057;
	font-size: 12px;
}

.file-size {
    color: #6c757d;
}

.card-description {
    flex: 1;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.update-info {
    font-size: 12px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
	margin-left: auto;
}

.update-label {
    font-weight: 500;
}

.update-date {
    font-weight: 400;
}

.important-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #bbdefb;
}

/* ===== カテゴリリスト CSS ===== */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-link {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #555;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    cursor: pointer;
}

.category-link:hover {
    background: #e9ecef;
    color: #333;
    border-color: #dee2e6;
    text-decoration: none;
}

.category-link.active {
    background: #0091da;
    color: white;
    border-color: #667eea;
}

.category-link.active:hover {
    background: #0091da;
    border-color: #5a6fd8;
}

/* モバイル用カテゴリリスト */
.mobile-sidebar .category-list {
    margin-top: 15px;
}

.mobile-sidebar .category-link {
    padding: 14px 16px;
    font-size: 16px;
}

/* ===== カラーユーティリティ ===== */
.text-red-500 { color: #ef4444; }
.text-blue-500 { color: #3b82f6; }
.text-green-500 { color: #10b981; }
.text-orange-500 { color: #f97316; }
.text-green-600 { color: #059669; }
.text-gray-600 { color: #4b5563; }
.text-red-600 { color: #dc2626; }
.text-purple-600 { color: #9333ea; }
.text-purple-500 { color: #a855f7; }
.text-blue-600 { color: #2563eb; }
.text-gray-500 { color: #6b7280; }

/* ===== ローディング・エラー ===== */
.loading-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading-spinner::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner i {
    color: #667eea;
    margin-bottom: 15px;
}

.loading-spinner p {
    margin: 0;
    font-size: 14px;
}

.no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-categories {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* エラーメッセージ */
.error-message {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}

/* ===== レスポンシブデザイン ===== */

/* タブレット（1024px以下） */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .desktop-sidebar {
        display: none;
    }
    
    .header-content {
        padding: 12px 20px;
    }
    
    .desktop-search {
        max-width: 300px;
        margin: 0 15px;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .content-header h2 {
        font-size: 24px;
    }
}

/* モバイル（768px以下） */
@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .mobile-icons {
        display: flex;
    }
    
    .header-content {
        padding: 12px 15px;
    }
    
    .site-title {
        font-size: 18px;
        flex: 1;
    }
    
    .desktop-search,
    .desktop-user {
        display: none;
    }
    
    .main-layout {
        padding: 20px 15px;
        gap: 15px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .card-content {
        padding: 16px;
        gap: 12px;
    }
    
    .card-header-new {
        gap: 12px;
    }
    
    .file-icon {
        width: 40px;
        height: 40px;
    }
    
    .file-icon i {
        font-size: 20px;
    }
    
    .card-title-new {
        font-size: 15px;
    }
    
    .file-info,
    .card-description {
        font-size: 13px;
    }
    
    .card-footer-new {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .mobile-sidebar {
        width: 85%;
        max-width: 300px;
    }
}

/* 小型モバイル（480px以下） */
@media (max-width: 480px) {
    .header-content {
        padding: 10px 12px;
    }
    
    .site-title {
        font-size: 16px;
    }
    
    .mobile-icons {
        gap: 15px;
    }
    
    .mobile-icon-btn {
        padding: 6px 8px;
        min-width: 44px;
    }
    
    .main-layout {
        padding: 15px 12px;
    }
    
    .main-content {
        padding: 16px 12px;
    }
    
    .content-header h2 {
        font-size: 20px;
    }
    
    .card-content {
        padding: 14px;
    }
    
    .mobile-sidebar {
        width: 90%;
    }
    
    .logout-link span {
        display: none;
    }
}

/* 極小モバイル（360px以下） */
@media (max-width: 360px) {
    .mobile-sidebar {
        width: 95%;
    }
    
    .site-title {
        font-size: 14px;
    }
}


.allowed-roles {
    font-size: 12px;
    color: #6c757d;
	margin-right: 10px;
}
.category-section{
    margin-bottom: 30px;
}


.tax-all,.tax-item-l1 {
    display: block;
    padding: 2px 0px;
    text-decoration: none;
    color: #555;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    cursor: pointer;
}