/* ============================================
   Portfolio Manager - メインスタイル
   カラー: 白 × 紺
   ============================================ */

:root {
    --navy: #1B2A4A;
    --navy-light: #2C4A7C;
    --navy-dark: #0F1A30;
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --red: #DC2626;
    --red-light: #FEE2E2;
    --green: #16A34A;
    --green-light: #DCFCE7;
    --yellow-light: #FEF9C3;
    --font: 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--navy-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== ナビゲーション ===== */
.navbar {
    background: var(--navy);
    color: var(--white);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
}

.nav-brand {
    color: var(--white) !important;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 30px;
    text-decoration: none !important;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-decoration: none !important;
    transition: background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

.nav-user {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    margin-left: auto;
    padding: 0 12px;
}

.btn-logout {
    color: rgba(255,255,255,0.7) !important;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 12px !important;
    border-radius: 4px !important;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1) !important;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    margin-left: auto;
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--navy);
        padding: 10px 20px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }
    .nav-links.open { display: flex; }
    .nav-user { margin-left: 0; padding: 8px 14px 0; }
}

/* ===== メインコンテナ ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ===== ログインページ ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    color: var(--navy);
    text-align: center;
    margin-bottom: 4px;
    font-size: 1.5rem;
}

.login-sub {
    text-align: center;
    color: var(--gray-400);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

/* ===== フォーム ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--gray-600);
}

.form-group small {
    color: var(--gray-400);
    font-weight: 400;
}

.required {
    color: var(--red);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--font);
    background: var(--white);
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy-light);
    box-shadow: 0 0 0 3px rgba(44,74,124,0.1);
}

textarea { resize: vertical; }

.input-search { max-width: 250px; }
.input-inline { width: auto; display: inline-block; max-width: 200px; }

.form-card {
    background: var(--white);
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ===== ボタン ===== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-600);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s;
    font-family: var(--font);
    line-height: 1.4;
}

.btn:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-primary {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

.btn-primary:hover {
    background: var(--navy-light);
    border-color: var(--navy-light);
}

.btn-danger {
    color: var(--red);
    border-color: var(--red);
}

.btn-danger:hover {
    background: var(--red);
    color: var(--white);
}

.btn-outline {
    border-color: var(--navy-light);
    color: var(--navy-light);
}

.btn-outline:hover {
    background: var(--navy-light);
    color: var(--white);
}

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; text-align: center; }

/* ===== アラート ===== */
.alert {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success { background: var(--green-light); color: #166534; }
.alert-error { background: var(--red-light); color: #991B1B; }
.alert-warning { background: var(--yellow-light); color: #854D0E; }

/* ===== テーブル ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.table thead th {
    background: var(--navy);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr.row-inactive { opacity: 0.5; }

.actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.text-muted { color: var(--gray-400); }

/* ===== ページヘッダー ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h2 {
    color: var(--navy);
    font-size: 1.4rem;
}

/* ===== 統計カード ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-top: 3px solid var(--navy);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ===== ダッシュボード ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.dashboard-section {
    background: var(--white);
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    color: var(--navy);
    font-size: 1.1rem;
}

.empty-text { color: var(--gray-400); font-size: 0.9rem; padding: 20px 0; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.empty-state p {
    color: var(--gray-400);
    margin-bottom: 16px;
}

/* ===== バッジ / タグ ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-500);
}

.badge-active { background: var(--green-light); color: #166534; }
.badge-inactive { background: var(--red-light); color: #991B1B; }
.badge-admin { background: var(--navy); color: var(--white); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ===== フィルター ===== */
.filters { margin-bottom: 20px; }

.filter-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form select { width: auto; max-width: 180px; }

/* ===== サムネイル ===== */
.thumb-cell { width: 60px; }

.thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.thumb-icon { font-size: 1.8rem; }
.thumb-icon-lg { font-size: 2.5rem; }

/* ===== ファイル選択グリッド ===== */
.file-filter-inline {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.file-filter-inline select { width: auto; max-width: 200px; }

.file-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.file-select-item {
    position: relative;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.file-select-item:hover {
    border-color: var(--navy-light);
}

.file-select-item input[type="checkbox"] {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.file-select-item:has(input:checked) {
    border-color: var(--navy);
    box-shadow: 0 0 0 2px rgba(27,42,74,0.2);
}

.file-select-thumb {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    overflow: hidden;
}

.file-select-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-select-info {
    padding: 8px;
}

.file-select-name {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-select-tag {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 2px;
}

/* ===== アップロードプレビュー ===== */
.file-preview {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 0.85rem;
}

.preview-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* ===== 共有設定ボックス ===== */
.share-box {
    background: var(--white);
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    border-left: 4px solid var(--navy);
}

.share-box h3 {
    color: var(--navy);
    margin-bottom: 16px;
}

.share-status { margin-bottom: 12px; }

.share-url-box {
    margin-bottom: 12px;
}

.share-url-box label {
    font-size: 0.85rem;
    color: var(--gray-500);
    display: block;
    margin-bottom: 4px;
}

.copy-group {
    display: flex;
    gap: 6px;
}

.copy-group input {
    flex: 1;
    font-size: 0.85rem;
    background: var(--gray-50);
}

.share-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.share-form .form-group { max-width: 400px; }

.copy-url-btn {
    cursor: pointer;
}

/* ===== ページネーション ===== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--gray-600);
    text-decoration: none !important;
}

.page-link:hover { background: var(--gray-100); }
.page-link.active {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* ===== フッター ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--gray-400);
    font-size: 0.8rem;
    margin-top: 40px;
}

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
    .container { padding: 16px 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .file-select-grid { grid-template-columns: repeat(2, 1fr); }
    .table { font-size: 0.8rem; }
    .table thead th, .table tbody td { padding: 8px 10px; }
    .login-box { margin: 20px; padding: 24px; }
}
