/* S3 Storage Manager - Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
}

.logo-icon {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

.btn-icon:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* Breadcrumbs */
.breadcrumbs {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s;
}

.breadcrumb-item:hover {
    background: var(--background);
    color: var(--text-primary);
}

.breadcrumb-item.active {
    color: var(--primary-color);
    font-weight: 500;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: 0.5rem;
    color: var(--border);
}

/* Stats Bar */
.stats-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    position: relative;
}

/* File Browser */
.file-browser {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    min-height: 400px;
    position: relative;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

/* File Item */
.file-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.file-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.file-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
}

.file-icon.folder {
    color: #f59e0b;
}

.file-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-name {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    word-break: break-word;
    width: 100%;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.empty-state svg {
    color: var(--border);
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* Drop Zone */
.drop-zone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(37, 99, 235, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone-content {
    color: white;
    text-align: center;
}

.drop-zone-content svg {
    color: white;
    margin-bottom: 1rem;
}

.drop-zone-content h3 {
    font-size: 2rem;
    font-weight: 600;
}

/* Preview Modal */
.preview-image-wrapper {
    width: 100%;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--background);
    border-radius: 0.75rem;
}

.preview-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.preview-frame {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 0.75rem;
    background: var(--surface);
}

.preview-video,
.preview-audio {
    width: 100%;
    max-height: 70vh;
    border-radius: 0.75rem;
    background: var(--background);
}

.preview-code {
    max-height: 70vh;
    overflow: auto;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.preview-error {
    color: var(--danger-color);
    padding: 1rem;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 0.5rem;
}

/* Upload Progress */
.upload-progress {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 400px;
    max-width: calc(100vw - 4rem);
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.upload-progress-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-progress-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.upload-queue {
    max-height: 300px;
    overflow-y: auto;
}

.upload-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.upload-item:last-child {
    border-bottom: none;
}

.upload-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-progress {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.upload-item-progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

.upload-item-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    z-index: 300;
    min-width: 180px;
}

.context-menu-item {
    width: 100%;
    background: none;
    border: none;
    padding: 0.625rem 1rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: var(--background);
}

.context-menu-item.danger {
    color: var(--danger-color);
}

.context-menu-item.danger:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.modal-content {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: calc(100vw - 4rem);
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Form Elements */
input[type="text"],
input[type="search"] {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="search"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: stretch;
    }
    
    .header-actions .btn {
        flex: 1;
    }
    
    .file-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
}

