@charset "UTF-8";

/* ====================================================
   🎨 共通変数・基本リセット
   ==================================================== */
:root {
    --primary-color: #4a90e2;    /* ソーダブルー */
    --accent-color: #ff6b81;     /* キャンディピンク */
    --text-color: #2c3e50;
    --border-color: #e2e8f0;
    --bg-color: #f8fafc;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

/* ====================================================
   🖥️ PC・タブレット共通基本レイアウト
   ==================================================== */
.app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 70px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

/* 👤 ヘッダー */
header {
    grid-area: header;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-bar {
    flex: 0 1 400px;
    margin: 0 20px;
}
.search-bar input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: #f1f5f9;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}
.search-bar input:focus {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.user-menu {
    position: relative;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 14px;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 260px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    margin-top: 8px;
    z-index: 1000;
}
.dropdown-menu.show { display: block; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border-color); margin: 10px 0; }
.dropdown-menu a { display: block; color: var(--text-color); text-decoration: none; padding: 6px 0; font-size: 14px; }
.dropdown-menu a:hover { color: var(--primary-color); }

/* 📂 サイドバー */
.sidebar {
    grid-area: sidebar;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
}
.nav-menu { list-style: none; }
.nav-item { margin-bottom: 8px; }
.nav-item a {
    display: block;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-item.active a, .nav-item a:hover {
    background: rgba(74, 144, 226, 0.08);
    color: var(--primary-color);
}

/* 🍬 メインコンテンツ */
main {
    grid-area: main;
    padding: 30px;
    background: var(--bg-color);
}

/* 📥 ドロップゾーン */
.dropzone {
    border: 2px dashed var(--primary-color);
    background: rgba(74, 144, 226, 0.02);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
    cursor: pointer;
    margin-bottom: 24px;
    transition: all 0.2s;
    font-size: 14px;
}
.dropzone.dragover {
    background: rgba(74, 144, 226, 0.1);
    transform: scale(0.99);
}

/* 🛠️ ボタンツールバー */
.action-menu-bar {
    margin-bottom: 24px;
}
.btn {
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* 📊 ファイルテーブル */
.file-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.01), 0 2px 4px -1px rgba(0,0,0,0.01);
    font-size: 14px;
}
.file-table th, .file-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.file-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #64748b;
}
.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: #fafbfc; }


/* ====================================================
   📱 スマートフォン専用レスポンシブ（画面幅768px以下）
   ==================================================== */
@media (max-width: 768px) {
    /* 1. 2段組みから「1列の縦並び」へ再ビルド */
    .app-container {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    /* 2. ヘッダーを縦に並べて要素をスマホ幅にフィット */
    header {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 12px;
        position: relative;
    }
    .search-bar {
        width: 100%;
        flex: none;
        margin: 0;
    }
    .user-menu {
        width: 100%;
        text-align: center;
    }
    .dropdown-menu {
        width: 100%;
        box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    }

    /* 3. サイドバー（メニュー）を上部に横スクロールで並べる */
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px;
        overflow-x: auto; /* 横スクロールを許可 */
        -webkit-overflow-scrolling: touch;
    }
    .nav-menu {
        display: flex; /* 横並びに変更 */
        gap: 8px;
    }
    .nav-item {
        margin-bottom: 0;
        flex-shrink: 0; /* 折り返しを禁止してパーツを維持 */
    }
    .nav-item a {
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap; /* テキストの改行を防ぐ */
    }

    /* 4. メインエリアの余白をスマホ用にスリム化 */
    main {
        padding: 15px;
        flex: 1;
    }

    /* 5. ツールバーのボタン群を「2列の綺麗なタイル状」に自動整列 */
    .action-menu-bar {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr); /* 均等に2分割 */
        gap: 8px;
    }
    .action-menu-bar .btn {
        width: 100% !important; /* 100%幅にしてグリッドにフィット */
        margin: 0 !important;
        font-size: 12px;
        padding: 5px !important;
    }

    /* 6. 【最重要】テーブルを横スクロール対応にして左右のはみ出しを完全消滅させる */
    main {
        overflow-x: hidden; /* メイン自体のはみ出しはカット */
    }
    .file-table {
        display: block;
        width: 100%;
        overflow-x: auto; /* テーブル単体で滑らかに横スクロールさせる */
        -webkit-overflow-scrolling: touch;
        white-space: nowrap; /* セル内の文字の変な改行を防ぐ */
    }
    .file-table th, .file-table td {
        padding: 12px 10px;
        font-size: 13px;
    }
}