/* デジタルアーカイブシステム スタイルシート */

:root {
    --primary-color: #4285f4;
    --primary-hover: #3367d6;
    --secondary-color: #6c757d;
    --success-color: #34a853;
    --warning-color: #fbbc04;
    --danger-color: #ea4335;
    --info-color: #00acc1;
    --purple-color: #9c27b0;

    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #495057;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-secondary: #6c757d;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.main-header {
    background-color: white;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.logo {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo:hover {
    color: var(--primary-hover);
}

.nav-separator {
    color: var(--text-secondary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.current-location {
    font-size: 1.1rem;
    color: var(--dark-gray);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-info span {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d33828;
}

.btn-small {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* トップバー */
.top-bar {
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.search-input {
    flex: 1;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    z-index: 2000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-error {
    background-color: #fce8e6;
    color: #c5221f;
    border-left: 4px solid var(--danger-color);
}

/* ディレクトリリスト */
.directories-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.directory-item {
    background-color: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 4px solid var(--warning-color);
}

.directory-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.directory-item-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    color: var(--warning-color);
}

.directory-item-icon svg {
    width: 100%;
    height: 100%;
}

.directory-item-content {
    flex: 1;
    min-width: 0;
}

.directory-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.directory-item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.directory-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.directory-item-arrow {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.directory-item-arrow svg {
    width: 100%;
    height: 100%;
}

/* ファイルリスト */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    background-color: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.file-item:hover {
    box-shadow: var(--shadow);
}

.file-item-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.file-item-icon.icon-viewable {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.file-item-icon.icon-download {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.file-item:has(.icon-viewable) {
    border-left-color: #667eea;
}

.file-item:has(.icon-download) {
    border-left-color: #f5576c;
}

.extension-badge {
    font-size: 0.7rem;
    color: white;
    letter-spacing: 0.5px;
}

.file-item-content {
    flex: 1;
    min-width: 0;
}

.file-item-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    line-height: 1.4;
}

.file-item-location {
    font-size: 0.85rem;
    color: var(--info-color);
    margin-bottom: 0.25rem;
}

.file-item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.file-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.meta-size {
    display: inline-flex;
    align-items: center;
}

.meta-date {
    display: inline-flex;
    align-items: center;
}

.file-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-color: var(--light-gray);
    color: var(--text-secondary);
    text-decoration: none;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.action-view {
    background-color: #e8f0fe;
    color: var(--primary-color);
}

.action-view:hover {
    background-color: var(--primary-color);
    color: white;
}

.action-download {
    background-color: #e6f4ea;
    color: var(--success-color);
}

.action-download:hover {
    background-color: var(--success-color);
    color: white;
}

.action-edit {
    background-color: #fef7e0;
    color: #f9ab00;
}

.action-edit:hover {
    background-color: #f9ab00;
    color: white;
}

.action-delete {
    background-color: #fce8e6;
    color: var(--danger-color);
}

.action-delete:hover {
    background-color: var(--danger-color);
    color: white;
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.empty-state p {
    font-size: 1.05rem;
}

.directory-description {
    background-color: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-left: 4px solid var(--info-color);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.5rem;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-color);
}

/* フォーム */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* プログレスバー */
.progress-bar {
    width: 100%;
    height: 32px;
    background-color: var(--light-gray);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #667eea);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

#progressText {
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

/* ログインページ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background-color: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.error-message {
    background-color: #fce8e6;
    color: #c5221f;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--danger-color);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .nav-separator {
        display: none;
    }

    .current-location {
        font-size: 0.95rem;
    }

    .user-info span {
        display: none;
    }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        width: 100%;
        min-width: 0;
    }

    .file-item {
        flex-wrap: wrap;
    }

    .file-item-content {
        width: 100%;
        order: 2;
    }

    .file-item-actions {
        width: 100%;
        order: 3;
        justify-content: flex-start;
    }

    .directory-item {
        padding: 1rem;
    }

    .directory-item-icon {
        width: 40px;
        height: 40px;
    }

    .notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .file-item-actions {
        gap: 0.3rem;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    .action-btn svg {
        width: 18px;
        height: 18px;
    }
}
