/**
 * 分享页面样式
 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

/* 分享容器 */
.share-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 加载状态 */
.share-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    color: #666;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(51, 102, 204, 0.1);
    border-top-color: #3366cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* 错误状态 */
.share-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    background: white;
    padding: 60px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin-top: calc(50vh - 250px);
    margin-left: calc(50vw - 250px);
    border-radius: 9px;
}

.error-icon {
    width: 80px;
    height: 80px;
    color: #f44336;
    margin-bottom: 20px;
}

.error-icon svg {
    width: 100%;
    height: 100%;
}

.share-error h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #333;
}

.share-error p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.share-error .btn-secondary {
    margin-bottom: 12px;
    min-width: 160px;
}

/* 分享内容 */
.share-content {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部 */
.share-header {
    background: #1d78ed;
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.share-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
}

.share-logo svg {
    width: 40px;
    height: 40px;
}

.share-info {
    flex: 1;
}

.share-info h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.share-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.share-owner,
.share-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.share-owner svg,
.share-date svg {
    width: 16px;
    height: 16px;
}

/* 面包屑导航 */
.share-breadcrumb {
    background: #ecf0f1;
    padding: 12px 30px;
    border-bottom: 1px solid #bdc3c7;
    flex-shrink: 0;
}

.breadcrumb-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.breadcrumb-item:hover {
    background: #bdc3c7;
    color: #2c3e50;
}

.breadcrumb-item svg {
    width: 16px;
    height: 16px;
}

.breadcrumb-separator {
    color: #999;
}

.breadcrumb-path {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* 工具栏 */
.share-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
    border-bottom: 1px solid #bdc3c7;
    background: white;
    gap: 16px;
    flex-shrink: 0;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #bdc3c7;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
}

.toolbar-btn:hover {
    background: #ecf0f1;
    border-color: #95a5a6;
    transform: translateY(-1px);
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

/* 搜索框 */
.share-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 36px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 200px;
}

.share-search-box:focus-within {
    border-color: #3366cc;
    box-shadow: 0 0 0 2px rgba(51, 102, 204, 0.15);
}

.share-search-icon {
    width: 16px;
    height: 16px;
    color: #95a5a6;
    flex-shrink: 0;
}

.share-search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #2c3e50;
    width: 100%;
    min-width: 0;
}

.share-search-input::placeholder {
    color: #95a5a6;
}

.share-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #95a5a6;
    border-radius: 50%;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

.share-search-clear:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.share-search-clear svg {
    width: 14px;
    height: 14px;
}

/* 搜索范围选择器 */
.share-search-scope {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: #f0f2f5;
    border-radius: 4px;
    flex-shrink: 0;
}

.share-scope-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #95a5a6;
    border-radius: 3px;
    transition: all 0.2s;
    padding: 0;
}

.share-scope-btn:hover {
    color: #3366cc;
    background: rgba(51, 102, 204, 0.08);
}

.share-scope-btn.active {
    color: #3366cc;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.share-scope-btn svg {
    width: 14px;
    height: 14px;
}

/* 项目计数 */
.share-item-count {
    font-size: 13px;
    color: #7f8c8d;
    white-space: nowrap;
    padding: 0 4px;
}

/* 视图切换组 */
.view-toggle {
    display: flex;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.view-btn {
    padding: 8px 12px;
    background: white;
    border: none;
    border-right: 1px solid #bdc3c7;
    cursor: pointer;
    transition: all 0.2s;
    color: #7f8c8d;
    position: relative;
}

.view-btn:last-child {
    border-right: none;
}

.view-btn:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.view-btn.active {
    background: #3366cc;
    color: white;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

/* 排序下拉框 */
.sort-select {
    position: relative;
}

.sort-select-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #bdc3c7;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #2c3e50;
    font-size: 14px;
    min-width: 140px;
}

.sort-select-trigger:hover {
    background: #ecf0f1;
    border-color: #95a5a6;
}

.sort-select-arrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.2s;
}

.sort-select.open .sort-select-arrow {
    transform: rotate(180deg);
}

.sort-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    min-width: 180px;
    overflow: hidden;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: #2c3e50;
    font-size: 14px;
}

.sort-option:hover {
    background: #ecf0f1;
}

.sort-option.active {
    background: rgba(51, 102, 204, 0.1);
    color: #3366cc;
    font-weight: 500;
}

.sort-option-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.sort-option.active .sort-option-icon {
    opacity: 1;
}

.sort-order-btn {
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: #7f8c8d;
    transition: all 0.2s;
    border-radius: 4px;
}

.sort-order-btn:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.sort-order-btn svg {
    width: 16px;
    height: 16px;
}

.sort-order-btn.desc svg {
    transform: rotate(180deg);
}

/* 文件列表容器 */
.file-list-container {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    background: #f8f9fa;
}

/* 文件列表 */
.file-list {
    display: grid;
    gap: 16px;
}

/* 大图标视图 - 默认 */
.file-list.grid-view-large {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* 中图标视图 */
.file-list.grid-view-medium {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* 小图标视图 */
.file-list.grid-view-small {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

/* 列表视图 */
.file-list.list-view {
    grid-template-columns: 1fr;
    gap: 8px;
}

/* 详细信息视图 */
.file-list.details-view {
    grid-template-columns: 1fr;
    gap: 0;
}

/* 文件项 */
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.file-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(51, 102, 204, 0.05);
    opacity: 0;
    transition: opacity 0.25s;
}

.file-item:hover {
    border-color: #3366cc;
    box-shadow: 0 6px 20px rgba(51, 102, 204, 0.12);
    transform: translateY(-3px);
}

.file-item:hover::before {
    opacity: 1;
}

/* 大图标视图样式 */
.grid-view-large .file-item {
    flex-direction: column;
    text-align: center;
    padding: 20px 16px;
}

.grid-view-large .file-icon {
    width: 72px;
    height: 72px;
    color: #3366cc;
    margin-bottom: 8px;
}

/* 中图标视图样式 */
.grid-view-medium .file-item {
    flex-direction: column;
    text-align: center;
    padding: 16px 12px;
}

.grid-view-medium .file-icon {
    width: 56px;
    height: 56px;
    color: #3366cc;
    margin-bottom: 6px;
}

/* 小图标视图样式 */
.grid-view-small .file-item {
    flex-direction: column;
    text-align: center;
    padding: 12px 10px;
}

.grid-view-small .file-icon {
    width: 44px;
    height: 44px;
    color: #3366cc;
    margin-bottom: 4px;
}

/* 列表视图样式 */
.list-view .file-item {
    padding: 12px 16px;
    border-radius: 6px;
}

.list-view .file-icon {
    width: 40px;
    height: 40px;
    color: #3366cc;
    flex-shrink: 0;
}

/* 详细信息视图样式 */
.details-view .file-item {
    padding: 10px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    background: transparent;
}

.details-view .file-item:first-child {
    border-top: none;
}

.details-view .file-item:hover {
    background: rgba(51, 102, 204, 0.05);
    transform: none;
    box-shadow: none;
}

.details-view .file-icon {
    width: 32px;
    height: 32px;
    color: #3366cc;
    flex-shrink: 0;
}

.file-icon svg {
    width: 100%;
    height: 100%;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.grid-view-large .file-info,
.grid-view-medium .file-info,
.grid-view-small .file-info {
    width: 100%;
}

.file-name {
    font-weight: 500;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
    font-size: 14px;
}

.grid-view-large .file-name {
    font-size: 15px;
    margin-bottom: 6px;
}

.grid-view-small .file-name {
    font-size: 13px;
    margin-bottom: 3px;
}

.file-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #7f8c8d;
}

.grid-view-large .file-meta,
.grid-view-medium .file-meta,
.grid-view-small .file-meta {
    justify-content: center;
    flex-wrap: wrap;
}

.details-view .file-meta {
    gap: 16px;
}

.file-size,
.file-date {
    white-space: nowrap;
}

/* 详细视图的额外信息 */
.details-view .file-item {
    display: grid;
    grid-template-columns: 32px 1fr 100px 120px;
    gap: 16px;
    align-items: center;
}

.details-view .file-icon {
    grid-column: 1;
}

.details-view .file-info {
    grid-column: 2;
}

.details-view .file-size {
    grid-column: 3;
    text-align: right;
    font-size: 13px;
    color: #2c3e50;
}

.details-view .file-date {
    grid-column: 4;
    text-align: right;
    font-size: 13px;
    color: #2c3e50;
}

/* 空文件夹 */
.empty-folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-folder svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-folder p {
    font-size: 16px;
}

/* 页脚 */
.share-footer {
    padding: 15px 30px;
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    border-top: 1px solid #bdc3c7;
    background: white;
    flex-shrink: 0;
}

.share-footer a {
    color: #3366cc;
    text-decoration: none;
}

.share-footer a:hover {
    text-decoration: underline;
}

/* 预览对话框 */
.preview-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.preview-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.preview-header h3 {
    font-size: 18px;
    color: #333;
}

.preview-close {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.preview-close:hover {
    color: #333;
}

.preview-close svg {
    width: 100%;
    height: 100%;
}

.preview-body {
    padding: 20px;
    overflow: auto;
    max-height: calc(90vh - 60px);
}

.preview-image-container {
    text-align: center;
}

.preview-image-container img {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    object-fit: contain;
}

.preview-video-container video {
    max-width: 100%;
    max-height: calc(90vh - 100px);
}

.preview-text-container {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.preview-text-container pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #333;
}

.preview-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    color: #999;
}

.preview-unsupported svg {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.preview-unsupported p {
    margin-bottom: 20px;
}

/* 通知 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: #4caf50;
}

.notification.error {
    background: #f44336;
}

.notification.warning {
    background: #ff9800;
}

/* 按钮样式 */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #232323;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    justify-content: center;
}

.btn-primary:hover {
    background: #555555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 102, 204, 0.3);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .share-header {
        flex-direction: column;
        text-align: center;
        padding: 15px 20px;
    }

    .share-info h1 {
        font-size: 24px;
    }

    .share-meta {
        justify-content: center;
    }

    .share-breadcrumb {
        padding: 10px 20px;
    }

    .share-toolbar {
        flex-direction: column;
        gap: 10px;
        padding: 10px 20px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .file-list-container {
        padding: 10px;
    }

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

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

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

    .preview-content {
        max-width: 95vw;
        max-height: 95vh;
    }
}

/* 受保护文件夹样式 */
.file-item.protected-folder {
    opacity: 0.6;
    cursor: not-allowed !important;
    background: #f5f5f5;
    border: 2px dashed #e74c3c !important;
    position: relative;
}

.file-item.protected-folder::after {
    content: '🔒 受保护';
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 11px;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    pointer-events: none;
}

.file-item.protected-folder:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: #e74c3c !important;
}

.file-item.protected-folder:hover::before {
    opacity: 0 !important;
}

.file-lock-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    color: #e74c3c;
    background: white;
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(231, 76, 60, 0.6);
    }
}

.file-lock-icon svg {
    width: 100%;
    height: 100%;
}

/* 网格视图中的锁头图标位置调整 */
.grid-view-large .file-lock-icon,
.grid-view-medium .file-lock-icon,
.grid-view-small .file-lock-icon {
    top: 10px;
    right: 10px;
}

/* 列表视图中的锁头图标位置调整 */
.list-view .file-lock-icon {
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
}

/* 详细信息视图中的锁头图标位置调整 */
.details-view .file-lock-icon {
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
}
