/* はみ出しチェック用 */
* {
	outline: 0px solid magenta;
}
/* 全体のスタイル */
body {
    font-family: 'BIZ UDPGothic', sans-serif;
    /* display: flex; を削除 */
    background-color: #f8f9fa;
    /* サイドバー開閉時のスクロール抑制 */
    overflow-x: hidden;
}

/* サイドバー */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background-color: #212529;
    color: white; /* ↓追加: サイドバー全体の文字色を白に */
    flex-shrink: 0;
    z-index: 1030;
    transition: transform 0.3s ease-in-out;
    transform: translateX(0);
    overflow-y: auto; /* ↓追加: コンテンツがはみ出たらスクロール可能にする */
    -webkit-overflow-scrolling: touch; /* iOSでスムーズなスクロール */
}
.sidebar h2 { /* ↓追加: サイドバーのタイトル色も白に */
    color: white;
}
.sidebar .nav-link {
    color: #adb5bd;
}
.sidebar .nav-link.active, .sidebar .nav-link:hover {
    color: white;
    background-color: #495057;
}

div.login-container{
	width:28vw;
	margin:15vh auto;
}

h2.loginh2{
	font-size:1em;
}

h2 img.imgh2login{
	width:60%;
	margin:0.5em auto;
}

/* 動くグラデーション背景 */
.animated-gradient-bg {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
  height: 100vh;
}

@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#tsparticles {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: -1; /* ログインフォームの背景になるように設定 */
        background-color: #dcd6d2;
      }

/* メインコンテンツ */
.content {
    margin-left: 250px; /* サイドバーの幅だけ右にずらす */
    width: calc(100% - 250px); /* 幅を画面の残り全体に設定 */
    height: 100vh; /* 画面の高さいっぱい */
    overflow-y: auto; /* 縦方向のコンテンツがはみ出たらスクロールさせる */
    padding: 0;
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out; /* スムーズなアニメーション */
}

/* メインコンテンツのパディングをデフォルトで設定（スマホで上書きされる） */
.content > .container-fluid,
.content > .p-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}


h2 img.h2h2{
	width:18vw;
	margin:0 auto;
}


/* ティッカー用のCSS */
        .ticker-wrap { overflow: hidden; background-color: #f8f9fa; border-bottom: 1px solid #dee2e6; }
        .ticker-move { display: inline-block; white-space: nowrap; animation: ticker 30s linear infinite; }
        .ticker-item { display: inline-block; padding: 0 2rem; }
        @keyframes ticker {
            0% { transform: translateX(0); }
            100% { transform: translateX(-50%); }
        }
        
        /* カードの高さを揃え、スクロールバーを出すCSS */
        .card-row {
            display: flex;
            flex-wrap: wrap;
        }
        .card-col {
            display: flex;
            flex-direction: column;
        }
        .card-equal-height {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
        }
        .card-scrollable {
            overflow-y: auto;
            max-height: 20vh; /* ← 高さをここで指定 */
        }
        .card-header{
        	padding:0.5em 0 0.5em 1em;
        	background:#f1f1f1;
        }




/* アプリケーションメニューのカード */
.app-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    align-items: center;
}
.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.app-card .app-icon {
    font-size: 2rem;
    color: #0a2463;
}

/* 新規ユーザー登録URLコピーボタン */
.copy-link {
    cursor: pointer;
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.8em;
    margin-left: 8px;
}
.copy-link:hover {
    text-decoration: underline;
}

/* 新しいメインヘッダーエリアのスタイル */
.main-header-area {
    background-image: url('../img/header.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: #333;
    position: relative;
    margin-bottom: 2rem;
}

.main-header-content {
    padding-left: 3rem;
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

/* h1タグ内の画像に直接スタイルを適用 */
.main-header-title {
    margin-bottom: 0.5rem;
    line-height: 1;
}
.main-header-title img {
    width: 11vw;
    height: auto;
    display: block;
}

.search-box {
    display: flex;
    width: 100%;
    max-width: 400px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.search-box .form-control {
    border: none;
    box-shadow: none;
    background-color: transparent;
}
.search-box .btn {
    border: none;
    background-color: #343a40;
    color: white;
    border-radius: 0;
}

/* メインコンテンツ内のカードと行の調整 */
.content > .card,
.content > .row {
    padding: 0 2rem;
    margin:0;
}

/* 各ページのH1タイトルスタイル (index.php以外) */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: 2rem 2rem 0; /* 上下左右の余白を調整 */
}
.content-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #343a40;
    padding-bottom: 0.5rem;
    border-bottom: 4px solid #0a2463;
    display: inline-block;
    margin-bottom: 0;
}


/* --- スマートフォン向けレスポンシブスタイル --- */

/* ハンバーガーメニューボタンのスタイル（HTMLに追記が必要） */
.navbar-toggler {
    display: none; /* デスクトップでは非表示 */
    position: fixed;
    top: 0.5em;
    right: 1em;
    z-index: 1040; /* サイドバーより手前 */
    background-color: #333; /* ボタンの背景色 */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.5rem;
}

/* サイドバーが開いているときにメインコンテンツを暗くするオーバーレイ */
.offcanvas-backdrop-custom {
    display: none; /* デフォルトは非表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1029; /* サイドバーのすぐ後ろ */
}

/* --- ファイルアップローダーのドラッグ＆ドロップエリア --- */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    color: #aaa;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.drop-zone--over {
    border-color: #0d6efd;
    background-color: #e9f5ff;
}

.drop-zone__input {
    display: none; /* 本物のinputは隠す */
}

.drop-zone__prompt {
    font-size: 1.2rem;
}

#file-list {
    margin-top: 1rem;
    font-size: 0.9rem;
}


/* メモ帳 AJAX保存通知用のスタイル */
.save-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.save-toast.show {
    opacity: 1;
}

#memo-form button span,
#memo-form a span{
	font-size:60%;
}


@media (max-width: 768px) {
    /* サイドバー */
    .sidebar {
        width: 250px;
        transform: translateX(-100%);
        left: 0;
        right: auto;
        top: 0;
        height: 100vh;
        background-color: #212529;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    
    div.login-container{
	width:77vw;
	margin:15vh auto;
}

h2.loginh2{
	font-size:1em;
}

h2 img.imgh2login{
	width:88%;
	margin:0.5em auto;
}

    /* メインコンテンツ */
    .content {
        margin-left: 0;
        width: 100%;
        min-height: 100vh;
        padding-top: 0px;
    }
    
    .navbar-toggler {
        display: block;
    }

    /* メインヘッダーエリア */
    .main-header-area {
        height: 20vh;
        margin-bottom: 1rem;
        padding-top: 0;
    }

    .main-header-content {
        padding-left: 1rem;
        align-items: flex-start;
    }

    .main-header-title img {
        width: 39vw;
    }

    .search-box {
        max-width: 77vw;
        margin-top: 0.5rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        margin: 1rem 1rem 0;
        padding: 0.8rem 1rem;
    }
    .content-header h1 {
        font-size: 1.3rem;
        padding-bottom: 0.3rem;
        border-bottom: 2px solid #0a2463;
        width: 100%;
        text-align: left;
    }

    .content > .card,
    .content > .row {
        padding: 0 1rem;
    }

    h2 img.h2h2{
        width:50vw;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    body.offcanvas-open .offcanvas-backdrop-custom {
        display: block;
    }
    
    .memonew{
    	width:100%;
    }
    
  /* ボタンと自動保存を囲む全体のコンテナ */
  .memo_edit_load_button {
    flex-direction: column; /* 要素を縦積みに変更 */
    align-items: stretch;   /* 子要素を幅いっぱいに広げる */
    gap: 1rem;              /* 上段（ボタン群）と下段（自動保存）の間に余白を追加 */
  }

  /* 上段のボタン3つを囲むコンテナ */
  .memo_edit_load_button > div:first-child {
    display: flex;          /* ボタンをフレックスボックスで横並びに */
    gap: 0.5rem;            /* ボタン間の余白 */
  }

  /* 上段の各ボタン（<a>タグも含む） */
  .memo_edit_load_button > div:first-child > .btn {
    flex: 1; /* 3つのボタンが利用可能なスペースを均等に分け合う */
    padding-left: 0.5rem;
    padding-right: 0.5rem; /* 文字がはみ出ないようにパディングを少し調整 */
  }

  /* 下段の自動保存エリアのコンテナ */
  .memo_edit_load_button > .ms-auto {
    margin-left: 0 !important; /* PC用のms-auto（左マージンを自動設定）を無効化 */
    justify-content: center;   /* 中の要素（スイッチと入力欄）を中央揃えに */
    width: 100%;
  }

  /* スマホでは不要なショートカットキーのテキストを非表示に */
  .memo_edit_load_button .btn span {
    display: none;
  }

    

    /* ▼▼▼ スマホ表示でテーブルを見やすくするCSSを修正 ▼▼▼ */
    .responsive-table thead {
        display: none; /* PC用のヘッダーは隠す */
    }
    .responsive-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: .25rem;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    .responsive-table td {
        display: block;
        text-align: left; /* 左寄せに戻す */
        border: none;
        padding: .25rem 0; /* 上下の余白を調整 */
    }
    .responsive-table td:before {
        display: none; /* data-labelの表示をなくす */
    }

    /* 各セルのスタイルを個別に調整 */
    .responsive-table td[data-label="タイトル"] {
        font-weight: bold;
        font-size: 1.1rem;
        margin-bottom: .5rem;
    }
    .responsive-table td[data-label="作成者"] {
        font-weight: bold;
        font-size: 1.1rem;
        margin-bottom: .5rem;
    }
    .responsive-table td[data-label="タグ"] {
        margin-bottom: .5rem;
    }
    .responsive-table td[data-label="最終更新日時"] {
        font-size: 0.8rem;
        color: #f6f6f6; /* Bootstrapのtext-mutedカラー */
        text-align: right;
    }
    .responsive-table td[data-label="操作"] {
        text-align: right;
        margin-top: .5rem;
    }


/* レスポンシブな履歴テーブルのためのスタイル（入れ子デザイン版・横スクロール対策済み） */

    .table-responsive-cards {
        border-collapse: collapse;
    }

    .table-responsive-cards thead {
        /* テーブルヘッダーを非表示に */
        display: none;
    }

    .table-responsive-cards tbody,
    .table-responsive-cards tr,
    .table-responsive-cards td {
        display: block;
        width: 100%;
    }

    .table-responsive-cards tr {
        margin-bottom: 1.5rem;
        border-radius: 5px;
        overflow: hidden; /* 角丸を有効にするため */
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    /* 1番目のセル（ファイル名）をヘッダーとして装飾 */
    .table-responsive-cards td:first-child {
        background-color: #333; /*  */
        color: #fff;
        font-weight: bold;
        font-size: 0.8em;
        text-align:left;
        padding: 0.5rem 1rem;
        /* ★長いファイル名が折り返されるようにする設定を追加 */
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    /* ヘッダーセルには疑似要素ラベルを表示しない */
    .table-responsive-cards td:first-child::before {
        display: none;
    }

    .table-responsive-cards td {
        padding: 0.25rem 1rem 0.25rem 45%; /* ラベル用のスペースを確保 */
        position: relative;
        text-align: right;
        border-bottom: 1px solid #eee;
        overflow-wrap: break-word; /* ★こちらも念のため追加 */
        word-break: break-word;
    }

    .table-responsive-cards td:last-child {
        border-bottom: none;
    }

    .table-responsive-cards td::before {
        /* data-label属性を使って項目名を表示 */
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 40%;
        padding-left: 1rem;
        font-weight: bold;
        text-align: left;
        color: #555;
        /* ★横にはみ出す原因になるため削除: white-space: nowrap; */
    }

    /* 画像に合わせて交互に行の背景色を設定 */
    .table-responsive-cards tr:nth-child(odd) {
        background-color: #fffef2; /* 黄色系 */
    }
    .table-responsive-cards tr:nth-child(even) {
        background-color: #f2faff; /* 青色系 */
    }
}