/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
    --dark: #2D3436;
    --light: #F7F9FC;
    --gray: #636E72;
    --light-gray: #DFE6E9;
    --white: #FFFFFF;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 16px;
    --radius-sm: 8px;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Navigation ===== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--dark);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--gray);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--light);
    color: var(--primary);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    color: var(--gray);
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 600;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--gray);
    font-size: 1.1rem;
}

/* ===== Users Grid ===== */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.user-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--dark);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 2px solid transparent;
}

.user-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--user-color, var(--primary));
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border: 3px solid;
    position: relative;
    flex-shrink: 0;
}

.avatar-emoji {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.admin-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: var(--accent);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: 2px solid var(--white);
}

.user-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.user-role {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.file-count {
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== User Header (detail page) ===== */
.user-header {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.user-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 4px solid;
}

.user-title h1 {
    font-size: 2rem;
    font-weight: 800;
}

.user-title p {
    color: var(--gray);
}

/* ===== Actions Bar ===== */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 2px solid var(--light-gray);
    border-radius: 50px;
    text-decoration: none;
    color: var(--gray);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tag-btn:hover,
.tag-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.upload-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), #FF8E8E);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* ===== Files Grid ===== */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.file-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.file-card.shared::after {
    content: '🌐';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.file-preview {
    aspect-ratio: 1;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.file-card:hover .file-preview img {
    transform: scale(1.05);
}

.video-placeholder,
.file-icon {
    text-align: center;
    color: var(--gray);
}

.video-placeholder span,
.file-icon span {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.file-info {
    padding: 1rem;
}

.file-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.85rem;
    color: var(--gray);
}

.download-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    opacity: 0;
}

.file-card:hover .download-btn {
    opacity: 1;
}

.download-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* ===== Tags Navigation ===== */
.tags-nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tag-pill {
    padding: 0.5rem 1rem;
    background: var(--light);
    border-radius: 50px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    transition: all 0.2s;
}

.tag-pill:hover,
.tag-pill.active {
    background: var(--primary);
    color: var(--white);
}

/* ===== Shared Header ===== */
.shared-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.shared-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent), #FFF59D);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.empty-state p {
    color: var(--gray);
    max-width: 400px;
    margin: 0 auto;
}

/* ===== Quick Actions ===== */
.quick-actions {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.quick-actions h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--light);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--secondary);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.5rem;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--light);
    color: var(--dark);
}

/* ===== Drop Area ===== */
.drop-area {
    border: 3px dashed var(--light-gray);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    margin: 1.5rem 0;
    transition: all 0.3s;
}

.drop-area.dragover {
    border-color: var(--primary);
    background: rgba(255, 107, 107, 0.05);
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.drop-text {
    font-size: 1.1rem;
    color: var(--dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-or {
    color: var(--gray);
    margin: 1rem 0;
}

.file-input-label {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.file-input-label:hover {
    background: #FF5252;
}

.file-input-label input {
    display: none;
}

/* ===== Upload Progress ===== */
.upload-progress {
    margin-top: 1.5rem;
}

.progress-bar {
    height: 8px;
    background: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s;
}

#progressText {
    text-align: center;
    color: var(--gray);
    font-weight: 600;
}

.upload-list {
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.upload-item.success {
    background: rgba(78, 205, 196, 0.1);
}

.upload-item.error {
    background: rgba(255, 107, 107, 0.1);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray);
    background: var(--white);
    margin-top: auto;
}

/* ===== Drag & Drop Zone ===== */
#dropZone.dragover {
    background: rgba(78, 205, 196, 0.05);
    border-radius: var(--radius);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }

    .files-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tags {
        order: 2;
    }

    .upload-btn {
        order: 1;
        width: 100%;
    }

    .user-profile {
        flex-direction: column;
        text-align: center;
    }

    .shared-header {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: 1fr;
    }

    .logo-text {
        display: none;
    }
}
