/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.header {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-nav a {
    color: #333;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.header-nav a:hover {
    background-color: #f0f0f0;
}

.user-info {
    color: #666;
    font-size: 0.9rem;
}

/* メインコンテンツ */
.main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* フッター */
.footer {
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 1.5rem 0;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* ログイン画面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.download-auth {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #333;
}

.login-form {
    margin-top: 1.5rem;
}

/* フォーム */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #4a90e2;
    color: #fff;
}

.btn-primary:hover {
    background-color: #357abd;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* アラート */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.alert-info {
    background-color: #eef;
    color: #33c;
    border: 1px solid #ccf;
}

/* ダッシュボード */
.dashboard {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard h1 {
    margin-bottom: 1rem;
    color: #333;
}

.dashboard-menu {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* テーブル */
.table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table tr:last-child td {
    border-bottom: none;
}

/* カード */
.card {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.card-body {
    margin-bottom: 1.5rem;
}

/* フィルター */
.filter-box {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-form .form-group {
    margin-bottom: 0;
}

/* ファイルリスト */
.file-list {
    list-style: none;
    padding: 0;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.file-item:hover {
    background-color: #f8f9fa;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #333;
}

.file-size {
    color: #666;
    font-size: 0.9rem;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.pagination a:hover {
    background-color: #f0f0f0;
}

.pagination .current {
    background-color: #4a90e2;
    color: #fff;
    border-color: #4a90e2;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .dashboard-menu {
        flex-direction: column;
    }

    .table {
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }
}

/* ファイルアップロード */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: #4a90e2;
    background: #f0f7ff;
}

.upload-area.dragover {
    border-color: #4a90e2;
    background: #e6f2ff;
}

.uploaded-files {
    margin-top: 1.5rem;
}

.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.upload-overlay-content {
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 240px;
}

.upload-overlay-text {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: #333;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.uploaded-file-item .file-thumbnail-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.uploaded-file-item .file-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: #f5f5f5;
}

.uploaded-file-item .file-delete-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    border: none;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: all 0.2s;
}

.uploaded-file-item .file-delete-btn:hover {
    background: #f2f2f2;
    transform: scale(1.1);
}

.uploaded-file-item .file-delete-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.uploaded-file-item .file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.uploaded-file-item .file-name {
    font-weight: 500;
    color: #333;
}

.uploaded-file-item .file-size {
    font-size: 0.875rem;
    color: #666;
}

.file-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.file-thumbnail-item {
    text-align: center;
}

.file-thumbnail-item img,
.file-thumbnail-item .file-icon {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: #f5f5f5;
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}

.file-thumbnail-item a:hover img,
.file-thumbnail-item a:hover .file-icon {
    opacity: 0.8;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.file-thumbnail-item a:hover .file-icon {
    background-color: #e8e8e8;
}

/* 確認画面テーブル */
.confirm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.confirm-table th {
    background-color: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    width: 200px;
    vertical-align: top;
}

.confirm-table td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
    vertical-align: top;
}

.confirm-table tr:last-child th,
.confirm-table tr:last-child td {
    border-bottom: none;
}

.confirm-table td .file-thumbnail-grid {
    margin-top: 0;
}

.file-thumbnail-item .file-name {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #333;
    word-break: break-all;
}
