@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
    --md-sys-color-primary: #D0BCFF;
    --md-sys-color-on-primary: #381E72;
    --md-sys-color-primary-container: #4F378B;
    --md-sys-color-on-primary-container: #EADDFF;
    --md-sys-color-secondary-container: #4A4458;
    --md-sys-color-on-secondary-container: #E8DEF8;
    --md-sys-color-background: #0F0E13;
    --md-sys-color-on-background: #E6E1E5;
    --md-sys-color-surface: #1C1B1F;
    --md-sys-color-surface-container: #211F26;
    --md-sys-color-surface-container-high: #2B2930;
    --md-sys-color-surface-container-highest: #36343B;
    --md-sys-color-error: #F2B8B5;
    --md-sys-color-outline: #938F99;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--md-sys-color-surface);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    color: var(--md-sys-color-primary);
}

.main-content {
    flex: 1;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero {
    padding: 40px 16px;
    text-align: center;
}

.hero h1 {
    font-size: 36px;
    margin-bottom: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--md-sys-color-primary), #EFB8C8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.file-card {
    background: var(--md-sys-color-surface-container);
    border-radius: 24px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: 100%;
    /* Important for uniform rows */
}

.file-card:hover {
    transform: translateY(-4px);
    background: var(--md-sys-color-surface-container-high);
}

.file-card:active {
    transform: scale(0.96);
}

.preview-container {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.file-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-card .icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    opacity: 0.8;
}

.card-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.file-card .name {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card .size {
    font-size: 11px;
    opacity: 0.6;
    text-align: center;
}

.card-actions {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.card-actions button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    transition: background 0.2s;
}

.card-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.card-actions .material-symbols-rounded {
    font-size: 20px;
}

.btn-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    z-index: 99;
    cursor: pointer;
}

.btn-primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 12px 20px;
    border-radius: 100px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

@media (max-width: 500px) {
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .file-card {
        padding: 10px;
        border-radius: 20px;
    }

    .preview-container {
        border-radius: 14px;
    }

    .header-actions .title-medium {
        display: none;
    }
}

.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-bottom-color: var(--md-sys-color-primary);
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}