﻿/* ===== 基础布局 ===== */
.main-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto 0 !important;
    padding: 0 20px;
    box-sizing: border-box;
}

.main-container > .container {
    width: 100%;
    max-width: 1600px;
    border-radius: 15px;
    margin: 20px auto 20px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    box-sizing: border-box;
}

/* ===== 头部 ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header h1 {
    color: #2c3e50;
    margin: 0;
    font-size: 2rem;
}

.upload-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #7b2dda, #3a86ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
}

/* ===== Flash 消息 ===== */
.flash-messages {
    margin-bottom: 20px;
}

.flash-message {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== 面包屑导航 ===== */
.breadcrumb {
    margin-bottom: 20px;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.05), rgba(37, 117, 252, 0.05));
    border-radius: 8px;
    font-size: 0.95rem;
    word-break: break-all;
}

.breadcrumb a {
    color: #6a11cb;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #2575fc;
    text-decoration: underline;
}

.breadcrumb-sep {
    color: #999;
    margin: 0 5px;
}

/* ===== 文件表格 ===== */
.file-table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(106, 17, 203, 0.1);
    -webkit-overflow-scrolling: touch;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: auto;
}

.file-table thead {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
}

.file-table th {
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.file-table th.col-name {
    width: auto;
    min-width: 120px;
}

.file-table th.col-time {
    width: 170px;
    text-align: center;
}

.file-table th.col-size {
    width: 100px;
    text-align: center;
}

.file-table th.col-action {
    width: 100px;
    text-align: center;
}

.file-table tbody tr {
    transition: all 0.2s ease;
}

.file-table tbody tr td {
    background: linear-gradient(135deg, #ffffff, #f8f9fa) !important;
}

.file-table tbody tr:hover td {
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.06), rgba(37, 117, 252, 0.06)) !important;
}

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

.file-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(106, 17, 203, 0.1);
}

.file-row td.col-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
}

.file-table td.col-time {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.file-table td.col-size {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.file-table td.col-action {
    text-align: center;
}

/* ===== 文件链接 ===== */
.file-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
}

.file-link:hover {
    color: #6a11cb;
}

.file-link .file-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* ===== 文件名（可选中的文本） ===== */
.file-name {
    -webkit-user-select: text;
    user-select: text;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 文件文本块 (移动端元信息) ===== */
.file-text-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.file-meta-mobile {
    display: none;
}


/* ===== 上级目录 ===== */
.folder-row td {
    background: rgba(106, 17, 203, 0.03) !important;
}

.parent-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6a11cb;
    text-decoration: none;
    font-weight: 500;
}

.parent-link:hover {
    color: #2575fc;
}

.parent-text {
    font-style: italic;
}

/* ===== 操作按钮 ===== */
.file-row td.col-action a {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 50px;
    text-align: center;
}

.download-btn {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
}

.file-row td.col-action a.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
}

.open-btn {
    background: linear-gradient(135deg, #f5f7fa, #e4e8eb);
    color: #2c3e50;
}

.file-row td.col-action a.open-btn:hover {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
}

/* ===== 返回首页按钮 ===== */
.back-link {
    display: inline-block;
    margin-top: 30px;
    padding: 15px 40px;
    background: linear-gradient(135deg, #ff8a6b 0%, #ff6f40 50%, #ff8a6b 100%);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 138, 107, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.back-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 138, 107, 0.6);
    background: linear-gradient(135deg, #ff7a5b 0%, #ff5f30 50%, #ff7a5b 100%);
}

.empty-message {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

/* ===== 上传弹窗 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-sizing: border-box;
}

.close {
    position: absolute;
    right: 20px;
    top: 12px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.close:hover {
    color: #6a11cb;
}

.modal-content h2 {
    margin: 0 0 25px;
    color: #2c3e50;
    font-size: 1.5rem;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.file-input, .key-input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
}

.upload-button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.upload-button:hover {
    background: linear-gradient(135deg, #7b2dda, #3a86ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
}

/* ===== 文件信息 ===== */
.file-info {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #666;
}

.file-info-name {
    font-weight: 600;
    color: #2c3e50;
}

.file-info-size {
    margin-left: 8px;
    color: #999;
}

/* ===== 上传进度条 ===== */
.upload-progress {
    margin-top: 20px;
    text-align: center;
}

.cancel-upload-btn {
    margin-top: 16px;
    padding: 8px 24px;
    border: 1px solid #ddd;
    background: #fff;
    color: #999;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: none;
}

.cancel-upload-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fff5f5;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6a11cb, #2575fc);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.progress-detail {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #999;
}

.upload-status {
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.upload-status.success {
    color: #27ae60;
}

.upload-status.error {
    color: #e74c3c;
}

/* ===== 覆盖确认弹窗 ===== */
.overwrite-modal-content {
    max-width: 420px;
    text-align: center;
}

.overwrite-modal-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3rem;
}

.overwrite-desc {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 25px 0;
}

.overwrite-desc span {
    font-weight: 600;
    color: #e67e22;
    word-break: break-all;
}

.overwrite-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-overwrite-confirm,
.btn-overwrite-cancel {
    padding: 10px 32px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-overwrite-confirm {
    background: #1890ff;
    color: #fff;
}

.btn-overwrite-confirm:hover {
    background: #40a9ff;
}

.btn-overwrite-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-overwrite-cancel:hover {
    background: #e8e8e8;
}

/* ===== 移动端适配 ===== */
/* 平板 */
@media (max-width: 768px) {
    .main-container {
        padding: 0 15px;
    }

    .main-container > .container {
        padding: 20px;
        margin-top: 15px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .upload-btn {
        padding: 12px;
        text-align: center;
        font-size: 1rem;
    }

    .file-table th,
    .file-table td {
        padding: 10px 8px;
    }

    .file-table th.col-time,
    .file-table td.col-time {
        display: none;
    }

    .file-table th.col-size,
    .file-table td.col-size {
        display: none;
    }

    .file-table th.col-action {
        width: 80px;
    }

    .back-link {
        padding: 12px 28px;
        font-size: 1rem;
    }

    .modal-content {
        margin: 5% auto;
        padding: 25px;
        width: 95%;
    }
}


/* 手机窄屏 - 卡片布局 */
@media (max-width: 480px) {
    .main-container {
        padding: 0 10px;
    }

    .main-container > .container {
        padding: 15px;
        border-radius: 10px;
        margin-top: 10px;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .breadcrumb {
        font-size: 0.85rem;
        padding: 8px 12px;
        margin-bottom: 15px;
    }

    /* 表格 -> 卡片布局 */
    .file-table,
    .file-table tbody,
    .file-table tr,
    .file-table td {
        display: block;
        box-sizing: border-box;
    }

    .file-table thead {
        display: none;
    }

    .file-table-container {
        overflow-x: visible;
        border-radius: 0;
        box-shadow: none;
    }

    /* 每个文件一个卡片 */
    .file-table tbody tr {
        margin-bottom: 10px;
        border: 1px solid rgba(106, 17, 203, 0.12);
        border-radius: 10px;
        padding: 0;
        background: white;
        box-shadow: 0 2px 8px rgba(106, 17, 203, 0.08);
    }

    .file-table tbody tr td {
        background: transparent !important;
        padding: 0;
        border: none;
        text-align: left;
    }

    .file-table tbody tr:hover td {
        background: transparent !important;
    }

    .folder-row td {
        background: transparent !important;
    }

    /* col-name 链接撑满卡片 */
    .file-row td.col-name {
        max-width: none;
        white-space: normal;
    }

    /* 卡片内容：icon 左，文字块右 flex 行 */
    .file-row td.col-name a.file-link {
        display: inline-flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        max-width: 100%;
        overflow: hidden;
        text-decoration: none;
        color: #2c3e50;
    }

    /* 图标 */
    .file-row td.col-name .file-icon {
        font-size: 1.6rem;
        flex-shrink: 0;
    }

    /* 文字块：flex 列，文件名在上 meta 在下 */
    .file-row td.col-name .file-text-block {
        display: flex;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    /* 文件名 */
    .file-row td.col-name .file-name {
        font-size: 1rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-user-select: text;
        user-select: text;
    }

    /* 元信息：灰色小字 */
    .file-meta-mobile {
        display: block !important;
        font-size: 0.78rem;
        color: #999;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 父目录 */
    .folder-row td {
        padding: 14px 16px;
    }

    .parent-link {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 1rem;
    }

    .parent-link .file-icon {
        font-size: 1.6rem;
    }

    /* 隐藏时间、大小、操作列 */
    .file-row td.col-time,
    .file-row td.col-size,
    .file-row td.col-action {
        display: none !important;
    }

    .back-link {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        font-size: 1rem;
        box-sizing: border-box;
        margin-top: 20px;
    }

    .modal-content {
        margin: 2% auto;
        padding: 20px;
        border-radius: 12px;
    }

    .modal-content h2 {
        font-size: 1.2rem;
    }
}
