:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-card-hover: rgba(51, 65, 85, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.3);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --accent-cyan: #06b6d4;
    --danger: #ef4444;
    --success: #10b981;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* Background gradient ambient shapes */
.bg-gradient-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.2;
}

.shape-1 {
    top: -10%;
    left: 20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary), transparent);
}

.shape-2 {
    bottom: -15%;
    right: 10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-cyan), transparent);
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
}

.brand-icon {
    width: 26px;
    height: 26px;
    color: var(--primary);
    flex-shrink: 0;
}

.nav-user-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.user-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    flex-shrink: 0;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
    flex: 1;
}

/* Glassmorphism Panel & Cards */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-glass);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-highlight);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.02rem;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-icon-sm {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.btn-icon-sm:hover {
    color: var(--danger);
}

/* Alerts */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Form Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-dim);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-icon-wrapper .form-input {
    padding-left: 2.75rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Login Page */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(80vh - 100px);
    padding: 1rem 0;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.user-badge-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid var(--border-highlight);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.login-header h2 {
    font-size: 1.45rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dashboard Top Bar (Search & Add Button) */
.dashboard-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 440px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-dim);
    pointer-events: none;
}

.search-input {
    padding-left: 2.75rem;
    background: var(--bg-card);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
}

.member-card {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.fb-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fb-avatar.lg {
    width: 76px;
    height: 76px;
}

.fb-avatar svg {
    width: 36px;
    height: 36px;
    color: #94a3b8;
}

.fb-avatar.lg svg {
    width: 46px;
    height: 46px;
}

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

.member-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.stat-badge {
    font-size: 0.76rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

/* Pagination Bar */
.pagination-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2.25rem;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 700;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Member Show Page */
.breadcrumb {
    margin-bottom: 1.25rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
}

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

.member-header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    padding: 1.5rem 1.75rem;
}

.member-header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.member-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Dropzone & Upload Progress Bar */
.upload-box {
    margin-bottom: 1.75rem;
}

.upload-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dropzone {
    border: 2px dashed var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 2rem 1.25rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}

.dropzone-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    font-size: 2.2rem;
    margin-bottom: 0.4rem;
}

/* Upload Progress Bar */
.upload-progress-wrapper {
    margin-top: 1.25rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
    box-shadow: 0 0 12px var(--primary-glow);
    border-radius: 5px;
    transition: width 0.15s ease-out;
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.selected-files-list {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-main);
    text-align: left;
}

/* Media Tabs & Grid */
.media-tabs-bar {
    margin-bottom: 1.25rem;
}

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

.tab-btn {
    padding: 0.45rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.15rem;
}

.media-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.media-thumbnail-container {
    height: 170px;
    position: relative;
    cursor: pointer;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.media-card:hover .media-thumb-img {
    transform: scale(1.05);
}

.video-thumb-placeholder {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
}

.media-thumb-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-btn-circle {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.85);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
    font-size: 0.9rem;
    z-index: 2;
}

.media-card:hover .play-btn-circle {
    transform: scale(1.1);
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: #38bdf8;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.media-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    z-index: 2;
}

.media-card-footer {
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.media-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
    max-width: 140px;
    font-family: monospace;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.hidden {
    display: none !important;
}

.modal-card {
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Lightbox */
.lightbox-content {
    max-width: 95vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 1rem;
}

.lightbox-close {
    position: absolute;
    top: -24px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2.2rem;
    cursor: pointer;
    line-height: 1;
}

.lightbox-title {
    color: #fff;
    margin-bottom: 0.75rem;
    font-weight: 500;
    font-size: 0.95rem;
    text-align: center;
    word-break: break-all;
}

.lightbox-media-container img, .lightbox-media-container video {
    max-width: 90vw;
    max-height: 75vh;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    object-fit: contain;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .nav-container { padding: 0.75rem 1rem; }
    .brand-logo { font-size: 1.1rem; }
    .user-status span:not(.status-dot) { display: none; }
    .main-container { padding: 0 1rem; margin: 1rem auto; }
    .dashboard-top-bar { flex-direction: column; align-items: stretch; gap: 0.85rem; }
    .search-box { max-width: 100%; width: 100%; }
    .dashboard-top-bar .btn { width: 100%; }
    .member-header-card { flex-direction: column; align-items: stretch; gap: 1.25rem; padding: 1.25rem; }
    .member-header-left { flex-direction: column; text-align: center; }
    .member-header-right { flex-direction: column; width: 100%; }
    .member-header-right .btn, .member-header-right form { width: 100%; }
    .member-header-right form .btn { width: 100%; }
    .media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.85rem; }
    .media-thumbnail-container { height: 140px; }
    .glass-panel { padding: 1.25rem; }
}

@media (max-width: 480px) {
    .members-grid { grid-template-columns: 1fr; }
    .media-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
    .media-thumbnail-container { height: 120px; }
    .media-card-footer { padding: 0.5rem; font-size: 0.78rem; }
    .media-filename { max-width: 100px; }
    .page-title { font-size: 1.4rem; text-align: center; }
    .modal-card { padding: 1.25rem; }
    .upload-actions { flex-direction: column; }
    .upload-actions .btn { width: 100%; }
}
