/* ===========================================
   gofiles.uk - 本家Gofile風UI
   =========================================== */

:root {
    --bg-base: #1c1f2e;
    --bg-card: #252836;
    --bg-elevated: #2d3142;
    --bg-input: #1a1d2a;
    --border: #3a3f50;
    --border-light: #2f3445;
    --text: #ffffff;
    --text-muted: #9ba0b4;
    --text-dim: #6b7088;
    --blue-primary: #4361ee;     /* ハンバーガー/リンクの鮮やかな青 */
    --blue-link: #5a7eff;
    --green: #22c55e;            /* 移動/プライマリアクション */
    --green-hover: #16a34a;
    --yellow-folder: #f5b800;    /* フォルダ黄 */
    --yellow-folder-dark: #d99e00;
    --video-blue: #4d8eff;       /* 動画アイコン */
    --red: #ef4444;
    --red-soft: rgba(239,68,72,.5);
    --orange-warn: #f97316;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --shadow-md: 0 4px 16px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
}

html, body { height: 100%; }

body {
    background-color: var(--bg-base);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

[hidden] { display: none !important; }

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 2;
}

/* ====== ヘッダー (ハンバーガー+右上アクション) ====== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-light);
}

.hamburger-btn {
    width: 46px;
    height: 46px;
    background-color: var(--blue-primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, transform .1s;
}
.hamburger-btn:hover { background-color: #3a52d8; }
.hamburger-btn:active { transform: scale(.96); }
.hamburger-btn .icon { width: 24px; height: 24px; }

.header-actions {
    display: flex;
    gap: 8px;
}

.header-action {
    width: 46px;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, color .15s;
}
.header-action:hover {
    background-color: var(--bg-elevated);
    color: var(--text);
}
.header-action .icon { width: 22px; height: 22px; }

/* ====== サイドメニュー ====== */
.menu-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,.55);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.menu-backdrop.open { opacity: 1; pointer-events: auto; }

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .28s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.side-menu.open { transform: translateX(0); }

.side-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}
.side-menu-head .logo {
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.4px;
}
.side-menu-head .logo .icon { color: var(--blue-primary); width: 22px; height: 22px; }

.side-menu-close {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.side-menu-close:hover { background-color: var(--bg-elevated); color: var(--text); }

.side-menu-nav {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.side-menu-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    transition: background-color .15s, color .15s;
}
.side-menu-nav a:hover { background-color: var(--bg-elevated); }
.side-menu-nav a .icon { color: var(--text-muted); width: 20px; height: 20px; }
.side-menu-nav a:hover .icon { color: var(--blue-link); }

.side-menu-foot {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
    color: var(--text-dim);
    font-size: 12px;
}

/* ====== メインエリア共通 ====== */
.main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 18px 18px 30px;
}

/* ====== Premium 広告バー ====== */
.ad-bar {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    padding: 18px 8px 22px;
}
.ad-bar a {
    color: var(--blue-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ====== 説明ボックス (description / link) ====== */
.desc-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px 16px;
    text-align: center;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 22px;
    background-color: transparent;
    word-break: break-all;
}

/* ====== フォルダ情報ヘッダー ====== */
.folder-block {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.folder-icon-wrap {
    position: relative;
    flex-shrink: 0;
}
.folder-svg {
    width: 64px;
    height: 64px;
    display: block;
}
.folder-badge {
    position: absolute;
    left: -4px;
    bottom: -4px;
    min-width: 22px;
    height: 22px;
    background-color: #5a607a;
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-base);
    padding: 0 5px;
}

.folder-meta { flex: 1; min-width: 0; }
.folder-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
    word-break: break-all;
    line-height: 1.2;
}
.folder-date {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
}
.folder-menu-btn {
    border: 1px solid var(--border);
    background-color: transparent;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background-color .15s, color .15s;
}
.folder-menu-btn:hover { background-color: var(--bg-elevated); color: var(--text); }
.folder-menu-btn .icon { width: 14px; height: 14px; }

/* ====== ツールバー ====== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 16px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0;
}
.toolbar .check-cell {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.toolbar-spacer { flex: 1; }

.tool-btn {
    width: 44px;
    height: 38px;
    background-color: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, transform .1s;
}
.tool-btn:hover { background-color: #3a3f55; }
.tool-btn:active { transform: scale(.96); }
.tool-btn.green {
    background-color: var(--green);
}
.tool-btn.green:hover { background-color: var(--green-hover); }
.tool-btn .icon { width: 18px; height: 18px; }

/* ====== チェックボックス ====== */
.check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-base);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, border-color .15s;
    flex-shrink: 0;
}
.check:hover { border-color: var(--blue-primary); }
.check.checked {
    background-color: var(--blue-primary);
    border-color: var(--blue-primary);
}
.check.checked::after {
    content: "";
    width: 11px;
    height: 6px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(1px,-1px);
}

/* ====== ファイル行 ====== */
.file-row {
    border-bottom: 1px solid var(--border-light);
    padding: 16px 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
}
.file-row:last-of-type { border-bottom: none; }

.file-main { min-width: 0; }

.file-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.file-head .check { margin-top: 2px; }
.file-type-icon {
    flex-shrink: 0;
    margin-top: 0;
}
.file-type-icon .icon { width: 30px; height: 30px; }
.file-type-icon.video { color: var(--video-blue); }
.file-type-icon.image { color: #4ade80; }
.file-type-icon.audio { color: #f472b6; }
.file-type-icon.doc { color: #60a5fa; }
.file-type-icon.archive { color: var(--yellow-folder); }
.file-type-icon.text { color: #d1d5db; }

.file-info {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}
.file-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
    margin-bottom: 4px;
    line-height: 1.25;
}
.file-meta {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* メディアサムネ */
.media-thumb {
    background-color: #000;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 14px;
    width: 100%;
    aspect-ratio: 16 / 11;
    max-height: 460px;
    position: relative;
}
.media-thumb .placeholder {
    width: 56%;
    height: 100%;
    background: linear-gradient(180deg, #5a6478 0%, #2a3142 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-thumb .placeholder.gradient-a {
    background: linear-gradient(160deg, #e8b774 0%, #c47834 45%, #5a3b25 100%);
}
.media-thumb .placeholder.gradient-b {
    background: linear-gradient(180deg, #c4a8b8 0%, #6a5a6c 60%, #2a2530 100%);
}
.media-thumb .play-overlay {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    pointer-events: none;
}
.media-thumb .play-overlay .icon { width: 24px; height: 24px; }

/* ファイル右アクション (縦並び) */
.file-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    align-self: flex-start;
    padding-top: 38px;
}
.file-action {
    width: 46px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, color .15s, border-color .15s;
}
.file-action:hover {
    background-color: var(--bg-elevated);
    color: var(--text);
    border-color: var(--blue-primary);
}
.file-action .icon { width: 20px; height: 20px; }

/* ====== エラー画面 (This content does not exist) ====== */
.error-card {
    border: 1px solid var(--red-soft);
    border-radius: var(--radius-md);
    background-color: transparent;
    padding: 18px 18px 18px 16px;
    margin-top: 22px;
}
.error-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.error-head .alert-icon {
    width: 36px;
    height: 36px;
    background-color: var(--red);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.error-head .alert-icon .icon {
    color: white;
    width: 22px;
    height: 22px;
}
.error-head h2 {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
}
.error-body {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.55;
}
.error-body p { margin-bottom: 10px; }
.error-body ul {
    list-style: disc;
    padding-left: 26px;
}
.error-body li { margin-bottom: 8px; }

/* ====== フッター (中央寄せ縦並び) ====== */
.footer {
    margin-top: auto;
    padding: 30px 16px 24px;
    border-top: 1px solid var(--border-light);
}
.footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 15px;
}
.footer-links a {
    transition: color .15s;
}
.footer-links a:hover { color: var(--text); }

/* ====== トップページ (アップロード) ====== */
.upload-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 50px 24px;
}
.main-title {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: -0.8px;
}
.sub-title {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 36px;
    max-width: 460px;
}
.upload-btn {
    background-color: var(--blue-primary);
    color: white;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 18px rgba(67,97,238,.4);
    transition: background-color .2s, transform .1s, box-shadow .2s;
}
.upload-btn:hover {
    background-color: #3a52d8;
    box-shadow: 0 6px 22px rgba(67,97,238,.5);
}
.upload-btn:active { transform: scale(.98); }
.upload-btn .icon { width: 22px; height: 22px; }
.demo-link {
    margin-top: 24px;
    color: var(--text-dim);
    font-size: 13px;
}
.demo-link a {
    color: var(--blue-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    display: inline-block;
    margin-left: 4px;
}

/* ドラッグオーバーレイ */
.drag-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(28, 31, 46, .92);
    border: 3px dashed var(--blue-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}
.drag-overlay.hidden { display: none; }
.drag-content { text-align: center; color: var(--blue-primary); }
.drag-content .icon { width: 80px; height: 80px; margin-bottom: 14px; }
.drag-content h2 { font-size: 1.4rem; font-weight: 600; }

/* ====== トースト ====== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    z-index: 300;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast .icon { color: var(--green); }

/* ====== 大画面でも本家のモバイル幅を維持 ====== */
@media (min-width: 760px) {
    .main { max-width: 720px; }
}

/* ====== アップロード進捗 ====== */
.upload-progress {
    position: fixed;
    inset: 0;
    background-color: rgba(28, 31, 46, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
    padding: 20px;
}
.upload-progress.hidden { display: none; }
.upload-progress-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.upload-progress-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.upload-progress-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 14px;
}
.progress-track {
    height: 8px;
    background-color: var(--bg-input);
    border-radius: 50px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-primary), #6a8aff);
    border-radius: 50px;
    transition: width .15s linear;
}
.upload-progress-percent {
    font-size: 14px;
    color: var(--blue-link);
    font-weight: 600;
}

/* ====== State Box (Loading/Error) ====== */
.state-box {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 16px;
}
.state-box .spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--border);
    border-top-color: var(--blue-primary);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state-error strong { color: var(--red); font-size: 16px; }
.state-error span { color: var(--text-muted); font-size: 13px; }

/* ====== media-thumb で実ファイルが入る時 ====== */
.media-thumb video,
.media-thumb img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    background-color: #000;
}
.media-thumb.image {
    aspect-ratio: auto;
    padding: 4px;
    background-color: var(--bg-input);
}
