* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --secondary: #6b7280;
    --bg: #f9fafb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --text-light: #6b7280;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    width: 48px;
    height: 48px;
}

header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    opacity: 0.9;
    font-size: 16px;
    font-weight: 400;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 8px 12px;
    font-size: 13px;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.breadcrumb-icon {
    width: 18px;
    height: 18px;
    color: var(--text-light);
}

/* File Manager */
.file-manager {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    min-height: 400px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.file-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.file-card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--primary);
}

.file-card-icon.folder {
    color: #f59e0b;
}

.file-card-name {
    font-weight: 500;
    margin-bottom: 8px;
    word-break: break-word;
    color: var(--text);
}

.file-card-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.file-card-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 8px;
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.loading-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* API Section */
.api-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.api-section h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: var(--text);
    font-size: 18px;
}

.api-section h3 i {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.endpoint-grid {
    display: grid;
    gap: 12px;
}

.endpoint-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.endpoint-method {
    background: var(--success);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.endpoint-card code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    flex: 1;
}

.endpoint-card span {
    color: var(--text-light);
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    animation: modalSlide 0.3s ease;
}

.modal-upload {
    max-width: 600px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
}

.modal-header h2 i {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: var(--text-light);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-close i {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.upload-area.dragover {
    border-color: var(--success);
    background: #f0fdf4;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--text-light);
    margin: 0 auto 16px;
}

.upload-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-subtext {
    font-size: 14px;
    color: var(--text-light);
}

.file-preview {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.file-preview-item i {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.file-preview-name {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}

.file-preview-size {
    font-size: 12px;
    color: var(--text-light);
}

/* Upload Progress */
.upload-progress-container {
    margin-top: 20px;
    display: none;
    flex-direction: column;
    gap: 12px;
}

.upload-progress-container.active {
    display: flex;
}

.progress-item {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-filename {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.progress-status {
    font-size: 12px;
    color: var(--text-light);
}

.progress-status.success {
    color: var(--success);
}

.progress-status.error {
    color: var(--danger);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.3s ease;
    border-radius: 99px;
}

.progress-fill.success {
    background: linear-gradient(90deg, var(--success), var(--success-dark));
}

.progress-fill.error {
    background: var(--danger);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast i {
    width: 20px;
    height: 20px;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.success i {
    color: var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.error i {
    color: var(--danger);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast.info i {
    color: var(--primary);
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    header {
        padding: 24px;
    }

    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    header h1 {
        font-size: 24px;
    }

    .toolbar-left {
        width: 100%;
    }

    .toolbar-left .btn {
        flex: 1;
        justify-content: center;
    }

    .file-grid {
        grid-template-columns: 1fr;
    }

    .endpoint-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .toast-container {
        left: 16px;
        right: 16px;
    }

    .toast {
        min-width: auto;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}