/* =====================================================
   AmiyaNetDisk - 扁平化明亮风格样式
   配色：浅蓝/白色为主，卡片式布局
   ===================================================== */

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    font-size: 16px;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #4a90d9;
    text-decoration: none;
}

a:hover {
    color: #357abd;
}

/* ===== Navigation ===== */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e8ecf1;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: #4a90d9;
}

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

.nav-link {
    padding: 8px 14px;
    border-radius: 6px;
    color: #555;
    font-size: 15px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: #f0f4f8;
    color: #333;
}

.nav-user {
    padding: 8px 4px;
    color: #888;
    font-size: 14px;
}

.btn-primary.nav-link {
    background: #4a90d9;
    color: #fff;
}

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

/* ===== Flash Messages ===== */
.flash-container {
    max-width: 800px;
    margin: 12px auto 0;
    padding: 0 20px;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.flash-danger  { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }
.flash-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.flash-info    { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

.flash-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    padding: 0 4px;
}

.flash-close:hover { opacity: 1; }

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

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

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

.btn-outline {
    background: #fff;
    color: #555;
    border-color: #d0d7de;
}

.btn-outline:hover {
    background: #f0f4f8;
    border-color: #b0b8c0;
}

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

.btn-danger:hover {
    background: #c62828;
}

.btn-success {
    background: #43a047;
    color: #fff;
    border-color: #43a047;
}

.btn-success:hover {
    background: #2e7d32;
}

.btn-disabled {
    background: #e0e0e0;
    color: #999;
    border-color: #d0d0d0;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== Auth ===== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: #333;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 15px;
    color: #888;
}

.form-links {
    text-align: right;
    margin-top: 8px;
}

.form-link {
    font-size: 14px;
    color: #4a90d9;
}

.form-link:hover {
    color: #357abd;
    text-decoration: underline;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.12);
}

.form-error {
    color: #e53935;
    font-size: 13px;
    margin-top: 4px;
    display: block;
}

.code-group {
    display: flex;
    gap: 8px;
}

.code-input {
    flex: 1;
}

.form-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 24px;
    margin-bottom: 24px;
}

.form-info {
    font-size: 14px;
    color: #888;
    margin-bottom: 16px;
}

/* ===== Search ===== */
.search-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.search-container {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.search-title {
    font-size: 36px;
    font-weight: 700;
    color: #4a90d9;
    margin-bottom: 8px;
}

.search-subtitle {
    color: #888;
    margin-bottom: 32px;
    font-size: 16px;
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-form .search-input {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    transition: box-shadow 0.2s;
}

.search-form .search-input:focus {
    box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}

.search-btn {
    padding: 14px 28px;
    font-size: 16px;
}

/* Search page */
.search-page {
    padding-top: 20px;
}

.search-bar {
    margin-bottom: 24px;
}

.search-form-inline {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-form-inline .search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 15px;
}

.search-form-inline .search-input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.12);
}

.search-info {
    color: #888;
    font-size: 15px;
    margin-bottom: 20px;
}

/* ===== File Grid ===== */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.file-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 24px;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.file-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.file-icon {
    text-align: center;
    margin-bottom: 12px;
    color: #4a90d9;
}

.file-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
    min-height: 24px;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: #e3f2fd;
    color: #1565c0;
}

.tag-root {
    background: #fce4ec;
    color: #c62828;
}

.tag-admin {
    background: #fff3e0;
    color: #e65100;
}

.tag-user {
    background: #e8f5e9;
    color: #2e7d32;
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: #999;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.file-card .btn {
    margin-top: auto;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    border: 1px solid #d0d7de;
    color: #555;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f0f4f8;
    border-color: #b0b8c0;
}

.page-active {
    background: #4a90d9;
    color: #fff;
    border-color: #4a90d9;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #999;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.empty-cell {
    text-align: center;
    color: #999;
    padding: 24px !important;
}

/* ===== Admin Layout ===== */
.admin-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.admin-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 16px 0;
    position: sticky;
    top: 76px;
}

.sidebar-title {
    font-size: 17px;
    font-weight: 700;
    padding: 8px 20px 16px;
    color: #333;
    border-bottom: 1px solid #e8ecf1;
    margin-bottom: 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    display: block;
    padding: 10px 20px;
    font-size: 15px;
    color: #555;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: #f0f4f8;
    color: #333;
}

.sidebar-link.active {
    background: #e3f2fd;
    color: #4a90d9;
    border-left-color: #4a90d9;
    font-weight: 500;
}

.admin-content {
    flex: 1;
    min-width: 0;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #333;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #4a90d9;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 15px;
    color: #888;
}

/* ===== Dashboard Sections ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.dashboard-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 24px;
}

.dashboard-section h2 {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

/* ===== Data Table ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e8ecf1;
}

.data-table th {
    font-weight: 600;
    color: #555;
    background: #f8f9fa;
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f5f7fa;
}

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

.action-cell {
    white-space: nowrap;
}

.action-cell .btn {
    margin-right: 4px;
}

.text-muted {
    color: #999;
}

/* ===== File Detail ===== */
.detail-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 0;
}

.detail-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 40px;
}

.detail-header {
    text-align: center;
    margin-bottom: 24px;
}

.detail-icon {
    color: #4a90d9;
    margin-bottom: 12px;
}

.detail-title {
    font-size: 26px;
    font-weight: 700;
    color: #333;
}

.detail-tags {
    text-align: center;
    margin-bottom: 24px;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 32px;
}

.detail-info-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e8ecf1;
    border-right: 1px solid #e8ecf1;
}

.detail-info-item:nth-child(even) {
    border-right: none;
}

.detail-info-full {
    grid-column: 1 / -1;
    border-right: none;
}

.detail-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 15px;
    color: #333;
}

.detail-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* File title link on card */
.file-title-link {
    color: #333;
    text-decoration: none;
}

.file-title-link:hover {
    color: #4a90d9;
}

/* ===== Footer ===== */
.footer {
    background: #fff;
    border-top: 1px solid #e8ecf1;
    padding: 20px 0;
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        position: static;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-link {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 8px 12px;
    }

    .sidebar-link.active {
        border-left-color: transparent;
        border-bottom-color: #4a90d9;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .search-form {
        flex-direction: column;
    }

    .search-hero {
        min-height: 60vh;
    }

    .auth-card {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .file-grid {
        grid-template-columns: 1fr;
    }

    .nav-container {
        padding: 0 12px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 14px;
    }

    .main-content {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Tag Input Widget ===== */
.tag-input-wrapper {
    position: relative;
}

.tag-input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.tag-input-field:focus {
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.12);
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d0d7de;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.tag-suggestions.visible {
    display: block;
}

.tag-suggestion-item {
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    color: #555;
    transition: background 0.15s;
}

.tag-suggestion-item:hover,
.tag-suggestion-item.active {
    background: #e3f2fd;
    color: #333;
}

.tag-suggestion-item.highlight {
    font-weight: 600;
    color: #4a90d9;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    min-height: 32px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    animation: tagIn 0.15s ease;
}

@keyframes tagIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.tag-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(21,101,192,0.15);
    color: #1565c0;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.tag-chip-remove:hover {
    background: rgba(21,101,192,0.3);
}

.tag-hidden-input {
    position: absolute;
    opacity: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ===== Folder Browser ===== */
.browser-page {
    max-width: 1180px;
    margin: 0 auto;
}

.browser-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.browser-search {
    min-width: 360px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: #667085;
    font-size: 14px;
}

.breadcrumbs a {
    color: #2f6fad;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.folder-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid #d8dee4;
    border-radius: 6px;
    color: #24292f;
    background: #fff;
    text-decoration: none;
}

.folder-tile:hover {
    border-color: #4a90d9;
    background: #f6fbff;
}

.folder-icon {
    color: #4a90d9;
    font-size: 20px;
}

.folder-name {
    overflow-wrap: anywhere;
    font-weight: 600;
}

.file-list-panel {
    border: 1px solid #d8dee4;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #d8dee4;
    color: #57606a;
    font-weight: 600;
}

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef1f4;
}

.file-row:last-child {
    border-bottom: none;
}

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

.file-row-title {
    margin: 0 0 4px;
    font-size: 16px;
}

.file-row-title a,
.file-folder-path {
    color: #24292f;
    text-decoration: none;
}

.file-row-title a:hover,
.file-folder-path:hover {
    color: #2f6fad;
}

.file-folder-path {
    display: inline-block;
    margin-bottom: 6px;
    color: #667085;
    font-size: 13px;
}

.file-row-meta,
.tag-list-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.file-row-meta {
    color: #667085;
    font-size: 13px;
}

.tag-list-inline {
    margin: 6px 0;
}

.search-mode {
    width: auto;
    min-width: 120px;
}

.detail-breadcrumbs {
    justify-content: center;
    margin: 10px 0 18px;
}

.campus-verify-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.muted {
    color: #667085;
    font-size: 14px;
}

.compact-form {
    margin-bottom: 18px;
}

.folder-create-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
    gap: 12px;
    align-items: end;
}

.folder-actions {
    display: grid;
    gap: 8px;
}

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

.table-input {
    width: min(260px, 100%);
}

.inline-action-form {
    display: inline-block;
    margin: 10px 0 16px;
}

.scope-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.scope-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid #d8dee4;
    border-radius: 6px;
    background: #fff;
    color: #24292f;
    font-size: 14px;
}

@media (max-width: 760px) {
    .browser-toolbar {
        flex-direction: column;
    }

    .browser-search {
        min-width: 0;
        width: 100%;
    }

    .file-row {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .campus-verify-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
