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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #dbeafe 0%, #ffffff 50%, #faf5ff 100%);
    color: #374151;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

/* Modern Navigation Header */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
}

.nav-brand {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.875rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb 0%, #9333ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.brand-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

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

.search-container {
    position: relative;
}

.search-input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    width: 320px;
    background: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
    border-color: transparent;
    box-shadow: 0 0 0 2px #3b82f6;
}

.search-container::before {
    content: '🔍';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.875rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.username-btn {
    background: none;
    border: none;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.username-btn:hover {
    background-color: #f3f4f6;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    min-width: 250px;
    z-index: 50;
    margin-top: 0.5rem;
}

.dropdown-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.profile-info {
    position: relative;
}

.dropdown-settings-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    font-size: 1rem;
}

.dropdown-settings-btn:hover {
    background-color: #f3f4f6;
}

.profile-info p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

/* Dropdown arrow styling */
.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.username-btn[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown actions section */
.dropdown-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dropdown-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    width: 100%;
    text-align: left;
}

.dropdown-action-btn:hover {
    background-color: #f3f4f6;
}

.dropdown-action-btn.settings-btn {
    color: #374151;
}

.dropdown-action-btn.admin-btn {
    color: #7c3aed;
}

.dropdown-action-btn.admin-btn:hover {
    background-color: #ede9fe;
}

.dropdown-action-btn.logout-btn {
    color: #dc2626;
}

.dropdown-action-btn.logout-btn:hover {
    background-color: #fee2e2;
}

.logout-btn {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: #b91c1c;
}

.settings-btn {
    background: none;
    border: none;
    color: #374151;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background-color: #f3f4f6;
    transform: rotate(90deg);
}

.settings-icon {
    font-size: 1.2rem;
}

/* Forms */
.form-container {
    background: white;
    max-width: 400px;
    margin: 3rem auto;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.form-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #1f2937;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Password input with show/hide button */
.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    padding-right: 3rem;
}

.show-password-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.show-password-btn:hover {
    color: #374151;
}

.show-password-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: currentColor;
}

.show-password-btn:hover svg {
    fill: #374151;
    stroke: #374151;
}

/* Shared users display */
.shared-with {
    color: #6b7280;
    font-size: 0.875rem;
}

.shared-users-more {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.shared-users-more:hover {
    background-color: #e5f3ff;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
    width: 100%;
    margin-bottom: 1rem;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    width: 100%;
    margin-bottom: 1rem;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-icon-only {
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 2.5rem;
    height: 2.5rem;
}

.btn-icon-only:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

.form-container p {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.form-container a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.form-container a:hover {
    text-decoration: underline;
}

.form-subtitle {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.invite-notice {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    background-color: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-top: 1rem;
}

.invitation-info {
    margin-bottom: 1.5rem;
}

.info-card {
    background: linear-gradient(135deg, #dbeafe 0%, #f0f9ff 100%);
    border: 1px solid #3b82f6;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.info-card h4 {
    color: #1e40af;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.info-card p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #374151;
}

/* Dashboard */
.dashboard {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

.library-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Library Tabs */
.library-tabs {
    display: flex;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 2rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: #374151;
    background: rgba(59, 130, 246, 0.05);
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: white;
}

/* Controls Section */
.controls-section {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-select {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.control-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-count {
    font-size: 0.875rem;
    color: #6b7280;
}

.upload-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.upload-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.view-toggle {
    display: flex;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    overflow: hidden;
}

.view-btn {
    background: white;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background-color: #f3f4f6;
}

.view-btn.active {
    background-color: #dbeafe;
    color: #2563eb;
}

/* Upload Progress */
.upload-progress {
    padding: 1rem 2rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Media Grid */
.media-grid {
    padding: 1rem;
    min-height: 400px;
}

.media-grid[data-view="grid"] {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.media-grid[data-view="list"] {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Media Card Styles */
.media-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #f3f4f6;
    cursor: pointer;
}

.media-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.media-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

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

.media-icon {
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-info {
    padding: 1rem;
}

.media-title {
    font-weight: 600;
    color: #111827;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-meta {
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.4;
}

.media-shared {
    color: #3b82f6;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.media-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #f3f4f6;
    group: hover;
}

.media-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.media-grid[data-view="list"] .media-item {
    display: flex;
    align-items: center;
}

.media-preview {
    position: relative;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-grid[data-view="list"] .media-preview {
    width: 200px;
    flex-shrink: 0;
    aspect-ratio: 16/9;
}

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

.media-item:hover .media-preview img {
    transform: scale(1.05);
}

.media-preview .file-icon {
    font-size: 3rem;
    color: #9ca3af;
}

.media-type-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    color: #374151;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.media-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.media-item:hover .media-overlay {
    background: rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.view-btn-overlay {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.view-btn-overlay:hover {
    background: white;
}

.media-info {
    padding: 1rem;
    flex: 1;
}

.media-grid[data-view="list"] .media-info {
    padding: 1rem 1.5rem;
}

.media-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.media-title {
    font-weight: 600;
    color: #111827;
    font-size: 1rem;
    line-height: 1.4;
    margin: 0;
}

.media-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 4px 8px;
}

.media-preview {
    position: relative;
}

.action-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.action-btn.like:hover {
    color: #dc2626;
}

.action-btn.download:hover {
    color: #2563eb;
}

.action-btn.share:hover {
    color: #059669;
}

.action-btn.info:hover {
    color: #7c3aed;
}

.media-actions .action-icon {
    width: 15px;
    height: 15px;
    color: #ffffff;
    transition: all 0.2s ease;
}

.action-icon {
    width: 15px;
    height: 15px;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.action-btn:hover .action-icon {
    color: inherit;
}

.media-actions .action-btn {
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.media-actions .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.media-actions .action-btn.share:hover .action-icon {
    color: #10b981;
}

.media-actions .action-btn.delete:hover .action-icon {
    color: #ef4444;
}

.media-actions .action-btn.info:hover .action-icon {
    color: #3b82f6;
}

/* Info Panel Modal Styles */
.info-panel-modal {
    max-width: 500px;
    width: 90%;
}

.info-section {
    padding: 0;
}

.info-header h4 {
    color: #374151;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    word-break: break-word;
}

.info-content {
    margin-bottom: 1.5rem;
}

.info-row {
    margin-bottom: 1rem;
}

.info-row label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.description-display {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem;
    min-height: 60px;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.description-edit {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
}

.description-edit:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.download-checkbox {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
}

.info-row label:has(.download-checkbox) {
    display: flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
}

.info-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.save-btn, .cancel-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.save-btn {
    background-color: #10b981;
    color: white;
}

.save-btn:hover {
    background-color: #059669;
}

.cancel-btn {
    background-color: #f3f4f6;
    color: #6b7280;
}

.cancel-btn:hover {
    background-color: #e5e7eb;
    color: #374151;
}

/* Ownership Indicator Styles */
.ownership-indicator {
    margin-top: 0.5rem;
}

.owner-badge, .viewer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.owner-badge {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.viewer-badge {
    background-color: #e5e7eb;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.owner-icon, .viewer-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.dark-theme .owner-badge {
    background-color: #451a03;
    color: #fbbf24;
    border-color: #92400e;
}

.dark-theme .viewer-badge {
    background-color: #374151;
    color: #9ca3af;
    border-color: #4b5563;
}

/* Hide actions container when empty */
.info-actions:empty {
    display: none !important;
}

.media-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.media-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.media-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.media-category {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

/* Empty State */
.empty-state {
    text-align: left;
    padding: 1.5rem 2rem;
    color: #6b7280;
    margin-top: 1rem;
}

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

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #6b7280;
    font-style: italic;
}

.loading-spinner::before {
    content: '⏳';
    margin-right: 0.5rem;
    animation: spin 2s linear infinite;
}

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

/* Message Display */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: 0.5rem;
    max-width: 350px;
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.message.show {
    transform: translateX(0);
    opacity: 1;
}

.message.success {
    background-color: #10b981;
    color: white;
}

.message.error {
    background-color: #ef4444;
    color: white;
}

.message.info {
    background-color: #3b82f6;
    color: white;
}

/* Login Error */
.login-error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease-out;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-input {
        width: 100%;
        max-width: 300px;
    }
    
    .controls-section {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .control-filters {
        justify-content: center;
    }
    
    .control-actions {
        justify-content: space-between;
    }
    
    .media-grid[data-view="grid"] {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .media-grid[data-view="list"] .media-item {
        flex-direction: column;
    }
    
    .media-grid[data-view="list"] .media-preview {
        width: 100%;
    }
    
    .dashboard {
        padding: 1rem;
    }
    
    .form-container {
        margin: 1rem auto;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 1.5rem;
    }
    
    .brand-subtitle {
        font-size: 0.75rem;
    }
    
    .media-grid[data-view="grid"] {
        grid-template-columns: 1fr;
    }
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.share-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.share-info p {
    margin: 0;
    color: #475569;
}

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

.form-help {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ========== Enhanced Upload Modal Styles ========== */
.upload-files-list {
    max-height: 200px;
    overflow-y: auto;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f9fafb;
}

.upload-file-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
}

.upload-file-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.upload-file-info {
    flex: 1;
}

.upload-file-name {
    font-weight: 500;
    color: #374151;
}

.upload-file-size {
    font-size: 0.875rem;
    color: #6b7280;
}

.upload-options {
    margin-bottom: 1rem;
}

.upload-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.upload-option:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.upload-option input[type="checkbox"]:checked + .checkmark + .option-text {
    color: #1d4ed8;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
}

.upload-option input[type="checkbox"] {
    display: none;
}

.upload-option input[type="checkbox"]:checked + .checkmark {
    background: #3b82f6;
    border-color: #3b82f6;
}

.upload-option input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-weight: bold;
    position: absolute;
    top: -2px;
    left: 3px;
    font-size: 14px;
}

.option-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.option-text small {
    color: #6b7280;
    font-size: 0.875rem;
}

.upload-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
}

.info-label {
    color: #6b7280;
    font-weight: 500;
}

/* ========== Enhanced Media Viewer Modal ========== */
.media-viewer-modal {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-btn {
    padding: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-btn:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.viewer-btn .btn-icon {
    font-size: 1rem;
}

.media-viewer-body {
    padding: 0;
}

.media-viewer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    max-height: 60vh;
    overflow: auto;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 1rem;
    position: relative;
}

.media-viewer-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.media-viewer-container video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    /* Disable text selection and drag */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Disable dragging */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    /* Disable pointer events on video to prevent right-click */
    pointer-events: auto;
}

.media-viewer-container audio {
    width: 100%;
    max-width: 400px;
    /* Disable text selection and drag for audio */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Disable dragging */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

.media-viewer-info {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

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

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.meta-label {
    font-weight: 500;
    color: #6b7280;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    background: #dcfce7;
    color: #16a34a;
}

.status-encrypted {
    color: #dc2626;
    font-weight: 600;
}

.encryption-indicator {
    background: #fef2f2;
    border-radius: 6px;
    padding: 0.5rem !important;
    border: 1px solid #fecaca !important;
}

.viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== Settings Modal Styles ========== */
.settings-modal {
    max-width: 800px;
    max-height: 80vh;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

.settings-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.settings-tab:hover {
    color: #374151;
    background: rgba(59, 130, 246, 0.05);
}

.settings-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.settings-content h4 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.network-actions {
    margin-bottom: 1.5rem;
}

/* Theme Selector */
.theme-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    min-width: 120px;
}

.theme-option:hover {
    border-color: #3b82f6;
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-option input[type="radio"]:checked + .theme-preview {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 0.25rem;
    border: 2px solid #e5e7eb;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.default-theme {
    background: linear-gradient(135deg, #dbeafe 0%, #ffffff 50%, #faf5ff 100%);
}

.dark-theme {
    background: linear-gradient(135deg, #1f2937 0%, #111827 50%, #0f172a 100%);
}

.theme-label {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

/* Dark Theme Styles */
body.dark-theme {
    background: linear-gradient(135deg, #1f2937 0%, #111827 50%, #0f172a 100%);
    color: #f3f4f6;
}

.dark-theme .navbar {
    background: rgba(31, 41, 55, 0.8);
    border-bottom-color: #374151;
}

.dark-theme .brand-title {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dark-theme .brand-subtitle {
    color: #9ca3af;
}

.dark-theme .search-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark-theme .search-input:focus {
    border-color: #3b82f6;
}

.dark-theme .username-btn {
    color: #f3f4f6;
}

.dark-theme .username-btn:hover {
    background-color: #374151;
}

.dark-theme .settings-btn {
    color: #f3f4f6;
}

.dark-theme .settings-btn:hover {
    background-color: #374151;
}

.dark-theme .user-dropdown {
    background: #374151;
    border-color: #4b5563;
}

.dark-theme .profile-info p {
    color: #e5e7eb;
}

/* Dark theme dropdown styles */
.dark-theme .dropdown-actions {
    border-top-color: #4b5563;
}

.dark-theme .dropdown-action-btn {
    color: #e5e7eb;
}

.dark-theme .dropdown-action-btn:hover {
    background-color: #4b5563;
}

.dark-theme .dropdown-action-btn.settings-btn {
    color: #e5e7eb;
}

.dark-theme .dropdown-action-btn.logout-btn {
    color: #f87171;
}

.dark-theme .dropdown-action-btn.logout-btn:hover {
    background-color: #4b5563;
}

.dark-theme .form-container {
    background: #374151;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.dark-theme .form-container h2 {
    color: #f3f4f6;
}

.dark-theme .form-group input {
    background: #4b5563;
    border-color: #6b7280;
    color: #f3f4f6;
}

.dark-theme .form-group input:focus {
    border-color: #3b82f6;
}

.dark-theme .library-container {
    background: #374151;
}

.dark-theme .library-tabs {
    background: #4b5563;
    border-bottom-color: #6b7280;
}

.dark-theme .tab-btn {
    color: #9ca3af;
}

.dark-theme .tab-btn:hover {
    color: #e5e7eb;
    background: rgba(59, 130, 246, 0.1);
}

.dark-theme .tab-btn.active {
    color: #60a5fa;
    background: #374151;
    border-bottom-color: #60a5fa;
}

.dark-theme .controls-section {
    border-bottom-color: #4b5563;
}

.dark-theme .filter-select {
    background: #4b5563;
    border-color: #6b7280;
    color: #f3f4f6;
}

.dark-theme .media-item {
    background: #4b5563;
    border-color: #6b7280;
}

.dark-theme .media-title {
    color: #f3f4f6;
}

.dark-theme .media-description {
    color: #d1d5db;
}

.dark-theme .modal-content {
    background: #374151;
}

.dark-theme .modal-header h3 {
    color: #f3f4f6;
}

.dark-theme .settings-tabs {
    border-bottom-color: #4b5563;
}

.dark-theme .settings-tab {
    color: #9ca3af;
}

.dark-theme .settings-tab:hover {
    color: #e5e7eb;
}

.dark-theme .settings-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.dark-theme .settings-content h4 {
    color: #f3f4f6;
}

.dark-theme .theme-description {
    color: #9ca3af;
}

.dark-theme .theme-option {
    border-color: #4b5563;
}

.dark-theme .theme-option:hover {
    border-color: #6b7280;
    background: rgba(59, 130, 246, 0.1);
}

.dark-theme .theme-option.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.dark-theme .theme-label {
    color: #f3f4f6;
}

/* Additional Theme Styles */
.theme-selector {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.theme-option:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.theme-option.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
}

.theme-preview.default-theme {
    background: linear-gradient(135deg, #dbeafe 0%, #ffffff 50%, #faf5ff 100%);
}

.theme-preview.dark-theme {
    background: linear-gradient(135deg, #1f2937 0%, #111827 50%, #0f172a 100%);
}

.theme-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 1rem;
    text-align: center;
}

/* Profile Form Styles */
.readonly-field {
    background-color: #f9fafb !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
}

.readonly-field:focus {
    box-shadow: none !important;
    border-color: #d1d5db !important;
}

.field-note {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    display: block;
}

.profile-value {
    font-weight: 500;
    color: #374151;
}

/* Dark theme profile styles */
.dark-theme .readonly-field {
    background-color: #374151 !important;
    color: #9ca3af !important;
    border-color: #4b5563 !important;
}

.dark-theme .field-note {
    color: #9ca3af;
}

.dark-theme .profile-value {
    color: #f3f4f6;
}

.dark-theme .form-group label {
    color: #f3f4f6;
}

/* Network Management Styles */
.network-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid #e9ecef;
}

.networks-list {
    margin-top: 1.5rem;
}

.network-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.network-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.1);
}

.network-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.network-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    margin: 0;
}

.network-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.network-description {
    color: #666;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.network-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 0.9rem;
}

.network-stats {
    display: flex;
    gap: 1rem;
}

.network-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.network-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.network-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.network-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.network-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.network-modal-header h4 {
    margin: 0;
    color: #333;
}

.network-modal-body {
    padding: 1.5rem;
}

.network-info {
    margin-bottom: 2rem;
}

.network-info h5 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #333;
}

.network-members h5 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.member-info {
    display: flex;
    flex-direction: column;
}

.member-name {
    font-weight: 600;
    color: #333;
}

.member-email {
    color: #666;
    font-size: 0.9rem;
}

.member-role {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.member-role.owner {
    background: #dc3545;
    color: white;
}

.member-role.admin {
    background: #fd7e14;
    color: white;
}

.member-role.member {
    background: #6c757d;
    color: white;
}

.member-actions {
    display: flex;
    gap: 0.5rem;
}

.member-actions .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.add-member-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #e9ecef;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.network-owner-badge {
    background: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.network-member-badge {
    background: #6c757d;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.empty-networks {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.empty-networks-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ccc;
}

/* Dark theme network styles */
.dark-theme .network-form {
    background: #374151;
    border-color: #4b5563;
}

.dark-theme .network-card {
    background: #374151;
    border-color: #4b5563;
}

.dark-theme .network-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 2px 8px rgba(96,165,250,0.1);
}

.dark-theme .network-name {
    color: #f3f4f6;
}

.dark-theme .network-description {
    color: #d1d5db;
}

.dark-theme .network-meta {
    color: #9ca3af;
}

.dark-theme .network-modal-content {
    background: #374151;
}

.dark-theme .network-modal-header {
    border-bottom-color: #4b5563;
}

.dark-theme .network-modal-header h4 {
    color: #f3f4f6;
}

.dark-theme .network-info h5 {
    color: #f3f4f6;
}

.dark-theme .info-label {
    color: #d1d5db;
}

.dark-theme .info-value {
    color: #f3f4f6;
}

.dark-theme .network-members h5 {
    color: #f3f4f6;
}

.dark-theme .member-item {
    background: #4b5563;
    border-color: #6b7280;
}

.dark-theme .member-name {
    color: #f3f4f6;
}

.dark-theme .member-email {
    color: #d1d5db;
}

.dark-theme .add-member-form {
    background: #4b5563;
    border-color: #6b7280;
}

.dark-theme .empty-networks {
    color: #9ca3af;
}

.dark-theme .empty-networks-icon {
    color: #6b7280;
}

/* Contact Picker Styles */
.contact-search-container {
    margin: 1rem 0;
}

.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.contact-suggestions {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.contact-item {
    padding: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.contact-item:hover {
    background-color: #f8f9fa;
}

.contact-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #007bff;
}

.contact-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    margin-right: 0.75rem;
    vertical-align: middle;
}

.contact-info {
    display: inline-block;
    vertical-align: middle;
}

.contact-name {
    font-weight: 600;
    color: #333;
    display: block;
}

.contact-email {
    color: #666;
    font-size: 0.85rem;
    display: block;
}

.recent-contacts, .selected-contacts {
    margin: 1rem 0;
}

.recent-contacts h6, .selected-contacts h6 {
    margin: 0 0 0.75rem 0;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
}

.contacts-list {
    max-height: 150px;
    overflow-y: auto;
}

.selected-contact-item {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 6px;
    padding: 0.75rem;
}

.selected-contact-item .contact-item {
    padding: 0;
    border: none;
    cursor: default;
}

.selected-contact-item .contact-item:hover {
    background: transparent;
}

.remove-contact-btn {
    float: right;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-contact-btn:hover {
    background: #c82333;
}

.empty-contacts {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.no-results {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-style: italic;
}

/* Dark theme contact picker */
.dark-theme .search-box input {
    background: #4b5563;
    border-color: #6b7280;
    color: #f3f4f6;
}

.dark-theme .search-box input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96,165,250,0.1);
}

.dark-theme .search-icon {
    color: #d1d5db;
}

.dark-theme .contact-suggestions {
    background: #374151;
    border-color: #4b5563;
}

.dark-theme .contact-item {
    border-bottom-color: #4b5563;
}

.dark-theme .contact-item:hover {
    background-color: #4b5563;
}

.dark-theme .contact-item.selected {
    background-color: #1e3a8a;
    border-left-color: #60a5fa;
}

.dark-theme .contact-name {
    color: #f3f4f6;
}

.dark-theme .contact-email {
    color: #d1d5db;
}

.dark-theme .recent-contacts h6, .dark-theme .selected-contacts h6 {
    color: #d1d5db;
}

.dark-theme .selected-contact-item {
    background: #065f46;
    border-color: #10b981;
}

.dark-theme .empty-contacts, .dark-theme .no-results {
    color: #9ca3af;
}

/* ========== Toast Notifications ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    max-width: 360px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-success { background-color: #10b981; }
.toast-error   { background-color: #ef4444; }
.toast-warning { background-color: #f59e0b; }
.toast-info    { background-color: #3b82f6; }

/* ========== Modal Size Variants ========== */
.modal-content.modal-medium {
    max-width: 540px;
    width: 90%;
}

.modal-content.modal-large {
    max-width: 860px;
    width: 92%;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ========== Form Input (generic) ========== */
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    background: white;
    color: #374151;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.form-input:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-static-value {
    padding: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ========== App Layout ========== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 40;
}

.app-footer {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-link {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #374151;
}

.version-badge {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-left: 0.5rem;
}

.main-content {
    flex: 1;
}

/* ========== Dashboard page ========== */
.dashboard-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #6b7280;
}

/* ========== Btn variants ========== */
.btn-danger {
    background-color: #ef4444;
    color: white;
    border: none;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
    border: none;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ========== Settings modal with sidebar nav ========== */
.settings-layout {
    display: flex;
    min-height: 420px;
}

.settings-nav {
    width: 160px;
    flex-shrink: 0;
    border-right: 1px solid #e5e7eb;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: #f9fafb;
}

.settings-nav .settings-tab {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border: none;
    border-right: 2px solid transparent;
    border-bottom: none;
    background: none;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-nav .settings-tab:hover {
    background: rgba(59,130,246,0.05);
    color: #374151;
}

.settings-nav .settings-tab.active {
    color: #3b82f6;
    border-right-color: #3b82f6;
    background: white;
}

.settings-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.settings-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.5rem 0;
}

/* Networks header */
.networks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.networks-header h4 {
    margin: 0;
}

.create-network-form {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.create-network-form h5 {
    margin: 0 0 1rem 0;
    color: #374151;
}

/* Loading text */
.loading-text {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Sessions */
.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.session-device {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.session-time {
    color: #9ca3af;
    font-size: 0.75rem;
}

.session-badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Nested modal (network details inside settings) */
.nested-modal {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.nested-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.network-detail-info {
    margin-bottom: 1.5rem;
}

.network-members-list {
    margin-top: 1rem;
}

/* Password input with toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    padding-right: 3rem;
}

.toggle-pw-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-pw-btn svg {
    width: 18px;
    height: 18px;
}

/* Theme options */
.theme-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.theme-preview-default {
    background: linear-gradient(135deg, #dbeafe 0%, #ffffff 50%, #faf5ff 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
    height: 80px;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    width: 120px;
}

.theme-preview-dark {
    background: linear-gradient(135deg, #1f2937 0%, #111827 50%, #0f172a 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
    height: 80px;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    width: 120px;
    color: #f3f4f6;
}

/* Viewer modal extras */
.viewer-modal .modal-body {
    padding: 1rem;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.viewer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
    color: #6b7280;
}

.viewer-meta {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 0;
    color: #9ca3af;
    font-size: 0.8rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.5rem;
}

.chunk-progress {
    padding: 1rem;
    text-align: center;
}

.chunk-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.chunk-progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
    width: 0;
    transition: width 0.3s ease;
}

.share-media-name {
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    word-break: break-all;
}

.info-description-display {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem;
    min-height: 60px;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.info-title {
    font-size: 1rem;
    font-weight: 600;
    word-break: break-all;
    margin: 0;
}

/* Dark theme additions */
.dark-theme .app-header {
    background: rgba(31,41,55,0.9);
    border-bottom-color: #374151;
}

.dark-theme .app-footer {
    background: #1f2937;
    border-top-color: #374151;
    color: #9ca3af;
}

.dark-theme .form-input {
    background: #4b5563;
    border-color: #6b7280;
    color: #f3f4f6;
}

.dark-theme .form-input:focus {
    border-color: #60a5fa;
}

.dark-theme .form-input:disabled {
    background-color: #374151;
    color: #6b7280;
}

.dark-theme .modal-close-btn {
    color: #d1d5db;
}

.dark-theme .modal-close-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
}

.dark-theme .settings-nav {
    background: #374151;
    border-right-color: #4b5563;
}

.dark-theme .settings-nav .settings-tab.active {
    background: #1f2937;
}

.dark-theme .settings-divider {
    border-top-color: #4b5563;
}

.dark-theme .create-network-form {
    background: #4b5563;
    border-color: #6b7280;
}

.dark-theme .nested-modal-content {
    background: #374151;
}

.dark-theme .session-item {
    border-color: #4b5563;
}

.dark-theme .session-device {
    color: #f3f4f6;
}

.dark-theme .info-description-display {
    background: #4b5563;
    border-color: #6b7280;
    color: #d1d5db;
}

.dark-theme .viewer-meta {
    border-top-color: #4b5563;
}

.dark-theme .share-media-name {
    background: #4b5563;
    color: #f3f4f6;
}

.dark-theme .loading-text {
    color: #6b7280;
}

/* Modern CSS Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Remove default styling */
html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Remove margin from common elements */
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
dl, dd, ol, ul,
figure, hr, fieldset, legend {
  margin: 0;
  padding: 0;
}

/* Remove list styles */
ol, ul {
  list-style: none;
}

/* Remove quotes */
blockquote, q {
  quotes: none;
}

blockquote::before,
blockquote::after,
q::before,
q::after {
  content: '';
  content: none;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Forms */
input,
button,
textarea,
select {
  font: inherit;
  margin: 0;
}

button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

input,
textarea {
  border: none;
  outline: none;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

/* Media */
img,
embed,
iframe,
object,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border: none;
}

/* Links */
a {
  background-color: transparent;
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Focus styles */
*:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
}

/* Better focus for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Hide elements but keep them accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Show elements when focused (for skip links) */
.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  *:focus {
    outline: 3px solid;
    outline-offset: 2px;
  }
}

/* Print styles */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  abbr[title]::after {
    content: " (" attr(title) ")";
  }
  
  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr,
  img {
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100%;
  }
  
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
}
/* Typography styles */
html {
  font-size: 16px;
  line-height: 1.6;
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 1rem 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 1rem 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
:root {
  /* Color Palette */
  --color-primary: #3b82f6;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #60a5fa;
  --color-secondary: #6b7280;
  --color-secondary-dark: #374151;
  --color-secondary-light: #9ca3af;
  
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Neutral Colors */
  --color-white: #ffffff;
  --color-black: #000000;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Semantic Colors (Light Theme) */
  --color-background: var(--color-white);
  --color-surface: var(--color-white);
  --color-surface-secondary: var(--color-gray-50);
  --color-border: var(--color-gray-200);
  --color-border-light: var(--color-gray-100);
  --color-text: var(--color-gray-900);
  --color-text-secondary: var(--color-gray-600);
  --color-text-muted: var(--color-gray-500);
  --color-text-inverse: var(--color-white);
  
  /* Interactive Colors */
  --color-focus: var(--color-primary);
  --color-hover: var(--color-gray-50);
  --color-active: var(--color-gray-100);
  --color-disabled: var(--color-gray-300);
  --color-disabled-text: var(--color-gray-500);
  
  /* Typography */
  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  --font-family-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;    /* 18px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;     /* 24px */
  --font-size-3xl: 1.875rem;   /* 30px */
  --font-size-4xl: 2.25rem;    /* 36px */
  --font-size-5xl: 3rem;       /* 48px */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Spacing Scale */
  --spacing-px: 1px;
  --spacing-0: 0;
  --spacing-1: 0.25rem;   /* 4px */
  --spacing-2: 0.5rem;    /* 8px */
  --spacing-3: 0.75rem;   /* 12px */
  --spacing-4: 1rem;      /* 16px */
  --spacing-5: 1.25rem;   /* 20px */
  --spacing-6: 1.5rem;    /* 24px */
  --spacing-8: 2rem;      /* 32px */
  --spacing-10: 2.5rem;   /* 40px */
  --spacing-12: 3rem;     /* 48px */
  --spacing-16: 4rem;     /* 64px */
  --spacing-20: 5rem;     /* 80px */
  --spacing-24: 6rem;     /* 96px */
  
  /* Borders */
  --border-width: 1px;
  --border-width-2: 2px;
  --border-width-4: 4px;
  
  --border-radius-none: 0;
  --border-radius-sm: 0.25rem;
  --border-radius: 0.375rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  --border-radius-2xl: 1.5rem;
  --border-radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  --shadow-outline: 0 0 0 3px rgba(59, 130, 246, 0.5);
  
  /* Transitions */
  --transition-duration-fast: 150ms;
  --transition-duration-normal: 200ms;
  --transition-duration-slow: 300ms;
  --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  
  /* Container Sizes */
  --container-xs: 20rem;    /* 320px */
  --container-sm: 24rem;    /* 384px */
  --container-md: 28rem;    /* 448px */
  --container-lg: 32rem;    /* 512px */
  --container-xl: 36rem;    /* 576px */
  --container-2xl: 42rem;   /* 672px */
  --container-3xl: 48rem;   /* 768px */
  --container-4xl: 56rem;   /* 896px */
  --container-5xl: 64rem;   /* 1024px */
  --container-6xl: 72rem;   /* 1152px */
  --container-7xl: 80rem;   /* 1280px */
  
  /* Breakpoints */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
  
  /* Focus Indicators */
  --focus-ring: 0 0 0 3px var(--color-focus);
  --focus-ring-offset: 2px;
  
  /* Animation */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  
  /* Layout */
  --header-height: 4rem;
  --sidebar-width: 16rem;
  --sidebar-width-collapsed: 4rem;
  
  /* Performance */
  --will-change-auto: auto;
  --will-change-scroll: scroll-position;
  --will-change-contents: contents;
  --will-change-transform: transform;
  
  /* Content Security */
  --content-security-policy: "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: blob:; connect-src 'self' https:; media-src 'self' blob:;";
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: var(--color-gray-900);
    --color-text-secondary: var(--color-gray-900);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-duration-fast: 0ms;
    --transition-duration-normal: 0ms;
    --transition-duration-slow: 0ms;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  :root {
    --color-background: white;
    --color-text: black;
    --color-primary: black;
    --shadow: none;
    --shadow-md: none;
    --shadow-lg: none;
  }
}
/* Grid Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}
/* Container layouts */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
}
/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  border: var(--border-width) solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-duration-normal) var(--transition-timing);
  user-select: none;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  width: auto;
  margin-bottom: 0;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: var(--color-text-inverse);
  border-color: var(--color-secondary);
  width: auto;
  margin-bottom: 0;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline-primary:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-outline-secondary {
  background-color: transparent;
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.btn-outline-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary);
  color: var(--color-text-inverse);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-hover);
}

.btn-success {
  background-color: var(--color-success);
  color: var(--color-text-inverse);
  border-color: var(--color-success);
}

.btn-warning {
  background-color: var(--color-warning);
  color: var(--color-text-inverse);
  border-color: var(--color-warning);
}

.btn-error {
  background-color: var(--color-error);
  color: var(--color-text-inverse);
  border-color: var(--color-error);
}

/* Button Sizes */
.btn-xs {
  padding: var(--spacing-1) var(--spacing-2);
  font-size: var(--font-size-xs);
}

.btn-sm {
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--spacing-4) var(--spacing-6);
  font-size: var(--font-size-lg);
}

.btn-xl {
  padding: var(--spacing-5) var(--spacing-8);
  font-size: var(--font-size-xl);
}

/* Icon Buttons */
.btn-icon-only {
  padding: var(--spacing-3);
  aspect-ratio: 1;
}

.btn-icon-only.btn-sm {
  padding: var(--spacing-2);
}

.btn-icon-only.btn-lg {
  padding: var(--spacing-4);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
}

/* Button Groups */
.btn-group {
  display: inline-flex;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  border-right-width: var(--border-width);
}

.btn-group .btn:hover {
  z-index: 1;
}

.btn-group .btn.active {
  z-index: 2;
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

/* Loading State */
.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* Floating Action Button */
.btn-fab {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--border-radius-full);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-fixed);
}

.btn-fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .btn {
    border-width: var(--border-width-2);
  }
  
  .btn-primary,
  .btn-secondary,
  .btn-success,
  .btn-warning,
  .btn-error {
    border-color: currentColor;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .btn-fab:hover {
    transform: none;
  }
  
  .btn-loading::after {
    animation: none;
  }
}

/* Dark Theme */
[data-theme="dark"] .btn-ghost {
  color: var(--color-text);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background-color: var(--color-gray-800);
}

/* Print Styles */
@media print {
  .btn {
    background: transparent !important;
    color: black !important;
    border: 1px solid black !important;
    box-shadow: none !important;
  }
  
  .btn-fab {
    display: none;
  }
}
/* Form styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Inputs inside form groups (no explicit class required) */
.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-duration-normal) ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Login / registration card */
.form-container {
  background: var(--color-white);
  max-width: 400px;
  margin: 3rem auto;
  padding: 2rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
}

.form-container h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--color-gray-900);
  font-weight: var(--font-weight-semibold);
}

.form-container p {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.form-container a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.form-container a:hover {
  text-decoration: underline;
}

/* Full-width submit button inside a form card */
.form-container .btn-primary {
  width: 100%;
  margin-bottom: 1rem;
}

/* Password input with show/hide toggle */
.password-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-container input {
  padding-right: 3rem;
}

.show-password-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-duration-normal) ease;
}

.show-password-btn:hover {
  color: var(--color-secondary-dark);
}

.show-password-btn svg {
  width: 20px;
  height: 20px;
}

/* Invite-only notice */
.invite-notice {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  background-color: var(--color-gray-50);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  margin-top: 1rem;
}

/* Inline field error */
.error-message {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  text-align: center;
  font-size: var(--font-size-sm);
}
/* Modals – backdrop, content, viewer, share, info panel */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.modal-medium {
  max-width: 540px;
  width: 90%;
}

.modal-content.modal-large {
  max-width: 860px;
  width: 92%;
}

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

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.modal-body {
  padding: 1.5rem;
}

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

/* Close buttons */
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

/* Media viewer modal */
.viewer-modal .modal-body {
  padding: 1rem;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.viewer-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.viewer-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.viewer-body {
  padding: 1rem;
}

.viewer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem;
  color: #6b7280;
}

.viewer-loading .loading-spinner {
  margin-bottom: 1rem;
}

.viewer-meta {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0;
  color: #9ca3af;
  font-size: 0.8rem;
  border-top: 1px solid #e5e7eb;
  margin-top: 0.5rem;
}

.media-viewer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  max-height: 60vh;
  overflow: auto;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  position: relative;
}

.media-viewer-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.media-viewer-container video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  user-select: none;
}

.loading-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  color: #ef4444;
}

/* Chunk progress */
.chunk-progress {
  padding: 1rem;
  text-align: center;
}

.chunk-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.chunk-progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 3px;
  width: 0;
  transition: width 0.3s ease;
}

.chunk-progress-text {
  font-size: 0.8rem;
  color: #6b7280;
}

/* Share modal */
.share-media-name {
  font-weight: 600;
  color: #374151;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 6px;
  word-break: break-all;
}

/* Info panel modal */
.info-title {
  font-size: 1rem;
  font-weight: 600;
  word-break: break-all;
  margin: 0;
}

.info-description-display {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.75rem;
  min-height: 60px;
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ownership-indicator {
  margin-top: 0.5rem;
}

.owner-badge,
.viewer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.owner-badge {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.viewer-badge {
  background-color: #e5e7eb;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

/* Settings modal */
.settings-layout {
  display: flex;
  min-height: 420px;
}

.settings-nav {
  width: 160px;
  flex-shrink: 0;
  border-right: 1px solid #e5e7eb;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #f9fafb;
}

.settings-nav .settings-tab {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: none;
  border-right: 2px solid transparent;
  border-bottom: none;
  background: none;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-nav .settings-tab:hover {
  background: rgba(59, 130, 246, 0.05);
  color: #374151;
}

.settings-nav .settings-tab.active {
  color: #3b82f6;
  border-right-color: #3b82f6;
  background: white;
}

.settings-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.settings-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.5rem 0;
}

/* Nested modal (network detail inside settings) */
.nested-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.nested-modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

/* Password input toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-input {
  padding-right: 3rem;
}

.toggle-pw-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 0.25rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-pw-btn svg {
  width: 18px;
  height: 18px;
}

/* Navigation – app header, navbar, search, user dropdown */

.app-header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 40;
}

.navbar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  box-sizing: border-box;
}

/* Brand */
.nav-brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.875rem;
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb 0%, #9333ea 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}

.brand-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

/* Nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Search */
.search-container {
  position: relative;
}

.search-container::before {
  content: '🔍';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.875rem;
  pointer-events: none;
}

.search-input {
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  width: 320px;
  background: white;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px #3b82f6;
}

/* User menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.username-btn {
  background: none;
  border: none;
  color: #374151;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.username-btn:hover {
  background-color: #f3f4f6;
}

.dropdown-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.username-btn[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown */
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  min-width: 250px;
  z-index: 50;
  margin-top: 0.5rem;
}

.user-icon-svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.75;
}

.user-icon-lg {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  text-align: left;
  transition: background 0.15s;
  margin-bottom: 0.25rem;
}

.profile-info:hover {
  background-color: #f3f4f6;
}

.profile-text {
  flex: 1;
  min-width: 0;
}

.profile-info p {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dropdown-action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  width: 100%;
  text-align: left;
}

.dropdown-action-btn:hover {
  background-color: #f3f4f6;
}

.dropdown-action-btn.admin-btn {
  color: #7c3aed;
}

.dropdown-action-btn.admin-btn:hover {
  background-color: #ede9fe;
}

.dropdown-action-btn.logout-btn {
  color: #dc2626;
}

.dropdown-action-btn.logout-btn:hover {
  background-color: #fee2e2;
}

/* Footer */
.app-footer {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 2rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-link {
  color: #6b7280;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #374151;
}

.version-badge {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-left: 0.5rem;
}

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

.main-content {
  flex: 1;
}

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

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .search-input {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .brand-title { font-size: 1.5rem; }
  .brand-subtitle { font-size: 0.75rem; }
}

/* Media Grid – library container, tabs, controls, grid/list views, cards */

.library-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Library Tabs */
.library-tabs {
  display: flex;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 2rem;
}

.tab-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: #374151;
  background: rgba(59, 130, 246, 0.05);
}

.tab-btn.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background: white;
}

/* Controls Section */
.controls-section {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-filters {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.results-count {
  font-size: 0.875rem;
  color: #6b7280;
}

.upload-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.upload-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.upload-icon {
  font-size: 1.2rem;
  font-weight: bold;
}

.view-toggle {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  overflow: hidden;
}

.view-btn {
  background: white;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  color: #6b7280;
  transition: all 0.2s ease;
}

.view-btn:hover {
  background-color: #f3f4f6;
}

.view-btn.active {
  background-color: #dbeafe;
  color: #2563eb;
}

/* Upload Progress */
.upload-progress {
  padding: 1rem 2rem;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Media section wrapper */
.media-section {
  padding: 0;
}

/* Media Grid */
.media-grid {
  padding: 1rem;
  min-height: 400px;
}

.media-grid[data-view="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.media-grid[data-view="list"] {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Media Item */
.media-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid #f3f4f6;
}

.media-item:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.media-grid[data-view="list"] .media-item {
  display: flex;
  align-items: center;
}

/* Media Preview */
.media-preview {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-grid[data-view="list"] .media-preview {
  width: 200px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
}

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

.media-item:hover .media-preview img {
  transform: scale(1.05);
}

.media-preview .file-icon {
  font-size: 3rem;
  color: #9ca3af;
}

/* Media Type Badge */
.media-type-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: #374151;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Media Overlay */
.media-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.media-item:hover .media-overlay {
  background: rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.view-btn-overlay {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: #374151;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.view-btn-overlay:hover {
  background: white;
}

/* Media Actions (overlay on preview) */
.media-actions {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  padding: 4px 8px;
}

.action-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.action-btn:hover {
  color: #374151;
  background-color: #f3f4f6;
}

.action-btn.like:hover { color: #dc2626; }
.action-btn.download:hover { color: #2563eb; }
.action-btn.share:hover { color: #059669; }
.action-btn.info:hover { color: #7c3aed; }

.action-icon {
  width: 15px;
  height: 15px;
  color: #9ca3af;
  transition: all 0.2s ease;
}

.media-actions .action-icon {
  color: #ffffff;
}

.action-btn:hover .action-icon {
  color: inherit;
}

.media-actions .action-btn {
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.media-actions .action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.media-actions .action-btn.share:hover .action-icon { color: #10b981; }
.media-actions .action-btn.delete:hover .action-icon { color: #ef4444; }
.media-actions .action-btn.info:hover .action-icon { color: #3b82f6; }

/* Media Info */
.media-info {
  padding: 1rem;
  flex: 1;
}

.media-grid[data-view="list"] .media-info {
  padding: 1rem 1.5rem;
}

.media-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.media-title {
  font-weight: 600;
  color: #111827;
  font-size: 1rem;
  line-height: 1.4;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-description {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.media-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.media-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.media-category {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: #dbeafe;
  color: #1e40af;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.media-shared {
  color: #3b82f6;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Empty State */
.empty-state {
  text-align: left;
  padding: 1.5rem 2rem;
  color: #6b7280;
  margin-top: 1rem;
}

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

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #6b7280;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
  .controls-section {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .control-filters {
    justify-content: center;
  }

  .control-actions {
    justify-content: space-between;
  }

  .media-grid[data-view="grid"] {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }

  .media-grid[data-view="list"] .media-item {
    flex-direction: column;
  }

  .media-grid[data-view="list"] .media-preview {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .media-grid[data-view="grid"] {
    grid-template-columns: 1fr;
  }
}

/* Messages – inline messages, login errors, toast notifications */

.message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem;
  border-radius: 0.5rem;
  max-width: 350px;
  z-index: 1000;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.message.show {
  transform: translateX(0);
  opacity: 1;
}

.message.success { background-color: #10b981; color: white; }
.message.error   { background-color: #ef4444; color: white; }
.message.info    { background-color: #3b82f6; color: white; }

/* Login error */
.login-error {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease-out;
}

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

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  max-width: 360px;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: auto;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { background-color: #10b981; }
.toast-error   { background-color: #ef4444; }
.toast-warning { background-color: #f59e0b; }
.toast-info    { background-color: #3b82f6; }

/* Security Settings Components */

.security-section {
  margin-bottom: 2rem;
}

.security-section h5 {
  color: var(--color-text);
  margin: 0 0 0.5rem 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.section-description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0 0 1.5rem 0;
  line-height: var(--line-height-relaxed);
}

/* Security Feature Cards */
.security-feature {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4);
  background: var(--color-surface-secondary);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-lg);
  transition: all var(--transition-duration-normal) var(--transition-timing);
}

.security-feature:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.security-feature-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  flex: 1;
}

.security-feature-icon {
  font-size: var(--font-size-2xl);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--border-radius-full);
}

.security-feature-content strong {
  display: block;
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-1);
}

.security-feature-content p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
}

.security-feature-action {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

/* Security Status Badges */
.security-status {
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--border-radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.security-status.enabled {
  background: var(--color-success);
  color: var(--color-text-inverse);
}

.security-status.disabled {
  background: var(--color-warning);
  color: var(--color-text-inverse);
}

/* Active Sessions */
.active-sessions {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin-bottom: var(--spacing-4);
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4);
  border-bottom: var(--border-width) solid var(--color-border);
  background: var(--color-surface);
  transition: background-color var(--transition-duration-normal) var(--transition-timing);
}

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

.session-item:hover {
  background: var(--color-hover);
}

.session-item.current-session {
  background: var(--color-surface-secondary);
}

.session-device {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.device-icon {
  font-size: var(--font-size-xl);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray-100);
  border-radius: var(--border-radius);
}

.device-details strong {
  display: block;
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--spacing-1);
}

.session-details {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0 0 var(--spacing-1) 0;
}

.session-time {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.current-badge {
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--color-success);
  color: var(--color-text-inverse);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

/* Danger Zone */
.danger-zone {
  border: var(--border-width-2) solid var(--color-error);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-6);
  background: rgba(239, 68, 68, 0.05);
}

.danger-zone h5 {
  color: var(--color-error);
}

.danger-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
}

.danger-content {
  flex: 1;
}

.danger-content strong {
  display: block;
  color: var(--color-error);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-1);
}

.danger-content p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
}

/* Password Strength Indicator */
.password-strength {
  margin-top: var(--spacing-2);
}

.password-strength-bar {
  height: 4px;
  background: var(--color-gray-200);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  margin-bottom: var(--spacing-1);
}

.password-strength-fill {
  height: 100%;
  transition: all var(--transition-duration-normal) var(--transition-timing);
  border-radius: var(--border-radius-sm);
}

.password-strength-fill.weak {
  width: 25%;
  background: var(--color-error);
}

.password-strength-fill.fair {
  width: 50%;
  background: var(--color-warning);
}

.password-strength-fill.good {
  width: 75%;
  background: var(--color-info);
}

.password-strength-fill.strong {
  width: 100%;
  background: var(--color-success);
}

.password-strength-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* Dark Theme Support */
[data-theme="dark"] .security-feature {
  background: var(--color-gray-800);
  border-color: var(--color-gray-700);
}

[data-theme="dark"] .security-feature:hover {
  border-color: var(--color-primary-light);
}

[data-theme="dark"] .device-icon {
  background: var(--color-gray-700);
}

[data-theme="dark"] .session-item {
  background: var(--color-gray-800);
  border-color: var(--color-gray-700);
}

[data-theme="dark"] .session-item:hover {
  background: var(--color-gray-700);
}

[data-theme="dark"] .session-item.current-session {
  background: var(--color-gray-700);
}

[data-theme="dark"] .danger-zone {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--color-error);
}

/* Responsive Design */
@media (max-width: 768px) {
  .security-feature {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-4);
  }
  
  .security-feature-action {
    width: 100%;
    justify-content: space-between;
  }
  
  .danger-action {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-3);
  }
  
  .session-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-3);
  }
  
  .session-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .security-feature {
    border-width: var(--border-width-2);
  }
  
  .danger-zone {
    border-width: 3px;
  }
  
  .security-status {
    border: var(--border-width) solid currentColor;
  }
}

/* Print Styles */
@media print {
  .danger-zone {
    background: white !important;
    border: 2px solid black !important;
  }
  
  .security-feature {
    background: white !important;
    border: 1px solid black !important;
  }
}
/* Admin Console */

.admin-page {
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* Navbar */
.admin-navbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.admin-navbar-title {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.admin-navbar-actions {
  display: flex;
  gap: 0.5rem;
}

/* Action dropdown */
.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.action-menu-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.action-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 168px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 200;
  overflow: hidden;
}

.action-dropdown.open {
  display: block;
}

.action-item {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.action-item:hover:not(:disabled) {
  background: #f3f4f6;
}

.action-item:disabled,
.action-item.action-item-disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.action-item.delete-item:not(:disabled) {
  color: #dc2626;
}

.action-item.delete-item:hover:not(:disabled) {
  background: #fef2f2;
}

.action-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.25rem 0;
}

/* Current-user row highlight */
.current-user-row {
  background: #f0f9ff;
}

.you-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
}

/* System modal tabs */
.system-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1rem;
  padding: 1rem 0 0;
}

.system-tab {
  padding: 0.5rem 1rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
  color: #374151;
}

.system-tab:hover:not(.active) {
  background: #e5e7eb;
}

.system-tab.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.system-panel {
  min-height: 300px;
}

.system-panel-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.system-data {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #374151;
}

.health-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.health-up   { background: #d1fae5; color: #065f46; }
.health-down { background: #fee2e2; color: #991b1b; }
.health-unknown { background: #fef3c7; color: #92400e; }

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead th {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.admin-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}

.admin-table tbody tr:last-child {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: #f9fafb;
}

.admin-table tbody td {
  padding: 0.75rem 1rem;
  color: #374151;
  vertical-align: middle;
}

.role-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.75rem;
  font-weight: 500;
}

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

/* Dark theme */
body.dark-theme .admin-navbar { border-bottom-color: #374151; }
body.dark-theme .admin-navbar-title { color: #f9fafb; }
body.dark-theme .action-menu-btn { background: #1f2937; border-color: #374151; color: #9ca3af; }
body.dark-theme .action-menu-btn:hover { background: #374151; border-color: #4b5563; color: #d1d5db; }
body.dark-theme .action-dropdown { background: #1f2937; border-color: #374151; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
body.dark-theme .action-item { color: #d1d5db; }
body.dark-theme .action-item:hover:not(:disabled) { background: #374151; }
body.dark-theme .action-item.delete-item:not(:disabled) { color: #f87171; }
body.dark-theme .action-item.delete-item:hover:not(:disabled) { background: #450a0a; }
body.dark-theme .action-divider { background: #374151; }
body.dark-theme .current-user-row { background: #1e3a5f; }
body.dark-theme .system-tab { background: #1f2937; border-color: #374151; color: #d1d5db; }
body.dark-theme .system-tab.active { background: #3b82f6; border-color: #3b82f6; color: white; }
body.dark-theme .system-tab:hover:not(.active) { background: #374151; }
body.dark-theme .system-data { background: #1f2937; border-color: #374151; color: #d1d5db; }
body.dark-theme .admin-table-wrap { border-color: #374151; }
body.dark-theme .admin-table thead th { background: #1f2937; color: #d1d5db; border-bottom-color: #374151; }
body.dark-theme .admin-table tbody tr { border-bottom-color: #1f2937; }
body.dark-theme .admin-table tbody tr:hover { background: #1f2937; }
body.dark-theme .admin-table tbody td { color: #d1d5db; }
body.dark-theme .role-badge { background: #1e3a5f; color: #93c5fd; }

body {
  background: linear-gradient(135deg, #dbeafe 0%, #ffffff 50%, #faf5ff 100%);
  color: var(--color-text);
  font-family: var(--font-family-sans);
  line-height: var(--line-height-normal);
  min-height: 100vh;
}

/* Dark Theme – applied via body.dark-theme */

body.dark-theme {
  background: linear-gradient(135deg, #1f2937 0%, #111827 50%, #0f172a 100%);
  color: #f3f4f6;
}

/* Navigation */
.dark-theme .app-header {
  background: rgba(31, 41, 55, 0.9);
  border-bottom-color: #374151;
}

.dark-theme .navbar {
  background: rgba(31, 41, 55, 0.8);
  border-bottom-color: #374151;
}

.dark-theme .brand-title {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dark-theme .brand-subtitle {
  color: #9ca3af;
}

.dark-theme .search-input {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

.dark-theme .search-input:focus {
  border-color: #3b82f6;
}

.dark-theme .username-btn {
  color: #f3f4f6;
}

.dark-theme .username-btn:hover {
  background-color: #374151;
}

.dark-theme .settings-btn {
  color: #f3f4f6;
}

.dark-theme .settings-btn:hover {
  background-color: #374151;
}

.dark-theme .user-dropdown {
  background: #374151;
  border-color: #4b5563;
}

.dark-theme .profile-info {
  color: #e5e7eb;
}

.dark-theme .profile-info:hover {
  background-color: #4b5563;
}

.dark-theme .profile-info p {
  color: #e5e7eb;
}

.dark-theme .dropdown-actions {
  border-top-color: #4b5563;
}

.dark-theme .dropdown-action-btn {
  color: #e5e7eb;
}

.dark-theme .dropdown-action-btn:hover {
  background-color: #4b5563;
}

.dark-theme .dropdown-action-btn.settings-btn {
  color: #e5e7eb;
}

.dark-theme .dropdown-action-btn.logout-btn {
  color: #f87171;
}

.dark-theme .dropdown-action-btn.logout-btn:hover {
  background-color: #4b5563;
}

.dark-theme .app-footer {
  background: #1f2937;
  border-top-color: #374151;
  color: #9ca3af;
}

/* Forms */
.dark-theme .form-container {
  background: #374151;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.dark-theme .form-container h2 {
  color: #f3f4f6;
}

.dark-theme .form-group label {
  color: #f3f4f6;
}

.dark-theme .form-group input {
  background: #4b5563;
  border-color: #6b7280;
  color: #f3f4f6;
}

.dark-theme .form-group input:focus {
  border-color: #3b82f6;
}

.dark-theme .form-input {
  background: #4b5563;
  border-color: #6b7280;
  color: #f3f4f6;
}

.dark-theme .form-input:focus {
  border-color: #60a5fa;
}

.dark-theme .form-input:disabled {
  background-color: #374151;
  color: #6b7280;
}

.dark-theme .readonly-field {
  background-color: #374151 !important;
  color: #9ca3af !important;
  border-color: #4b5563 !important;
}

.dark-theme .field-note {
  color: #9ca3af;
}

.dark-theme .profile-value {
  color: #f3f4f6;
}

/* Media Grid */
.dark-theme .library-container {
  background: #374151;
}

.dark-theme .library-tabs {
  background: #4b5563;
  border-bottom-color: #6b7280;
}

.dark-theme .tab-btn {
  color: #9ca3af;
}

.dark-theme .tab-btn:hover {
  color: #e5e7eb;
  background: rgba(59, 130, 246, 0.1);
}

.dark-theme .tab-btn.active {
  color: #60a5fa;
  background: #374151;
  border-bottom-color: #60a5fa;
}

.dark-theme .controls-section {
  border-bottom-color: #4b5563;
}

.dark-theme .filter-select {
  background: #4b5563;
  border-color: #6b7280;
  color: #f3f4f6;
}

.dark-theme .media-item {
  background: #4b5563;
  border-color: #6b7280;
}

.dark-theme .media-title {
  color: #f3f4f6;
}

.dark-theme .media-description {
  color: #d1d5db;
}

/* Modals */
.dark-theme .modal-content {
  background: #374151;
}

.dark-theme .modal-header h3 {
  color: #f3f4f6;
}

.dark-theme .modal-close-btn {
  color: #d1d5db;
}

.dark-theme .modal-close-btn:hover {
  background: #4b5563;
  color: #f3f4f6;
}

.dark-theme .nested-modal-content {
  background: #374151;
}

.dark-theme .info-description-display {
  background: #4b5563;
  border-color: #6b7280;
  color: #d1d5db;
}

.dark-theme .viewer-meta {
  border-top-color: #4b5563;
}

.dark-theme .share-media-name {
  background: #4b5563;
  color: #f3f4f6;
}

.dark-theme .loading-text {
  color: #6b7280;
}

/* Settings */
.dark-theme .settings-tabs {
  border-bottom-color: #4b5563;
}

.dark-theme .settings-tab {
  color: #9ca3af;
}

.dark-theme .settings-tab:hover {
  color: #e5e7eb;
}

.dark-theme .settings-tab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

.dark-theme .settings-content h4 {
  color: #f3f4f6;
}

.dark-theme .settings-nav {
  background: #374151;
  border-right-color: #4b5563;
}

.dark-theme .settings-nav .settings-tab.active {
  background: #1f2937;
}

.dark-theme .settings-divider {
  border-top-color: #4b5563;
}

.dark-theme .create-network-form {
  background: #4b5563;
  border-color: #6b7280;
}

/* Theme selector */
.dark-theme .theme-description {
  color: #9ca3af;
}

.dark-theme .theme-option {
  border-color: #4b5563;
}

.dark-theme .theme-option:hover {
  border-color: #6b7280;
  background: rgba(59, 130, 246, 0.1);
}

.dark-theme .theme-option.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.dark-theme .theme-label {
  color: #f3f4f6;
}

/* Badges */
.dark-theme .owner-badge {
  background-color: #451a03;
  color: #fbbf24;
  border-color: #92400e;
}

.dark-theme .viewer-badge {
  background-color: #374151;
  color: #9ca3af;
  border-color: #4b5563;
}

/* Sessions */
.dark-theme .session-item {
  border-color: #4b5563;
}

.dark-theme .session-device {
  color: #f3f4f6;
}

/* Networks */
.dark-theme .network-form {
  background: #374151;
  border-color: #4b5563;
}

.dark-theme .network-card {
  background: #374151;
  border-color: #4b5563;
}

.dark-theme .network-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.1);
}

.dark-theme .network-name {
  color: #f3f4f6;
}

.dark-theme .network-description {
  color: #d1d5db;
}

.dark-theme .network-meta {
  color: #9ca3af;
}

.dark-theme .network-modal-content {
  background: #374151;
}

.dark-theme .network-modal-header {
  border-bottom-color: #4b5563;
}

.dark-theme .network-modal-header h4 {
  color: #f3f4f6;
}

.dark-theme .network-info h5 {
  color: #f3f4f6;
}

.dark-theme .info-label {
  color: #d1d5db;
}

.dark-theme .info-value {
  color: #f3f4f6;
}

.dark-theme .network-members h5 {
  color: #f3f4f6;
}

.dark-theme .member-item {
  background: #4b5563;
  border-color: #6b7280;
}

.dark-theme .member-name {
  color: #f3f4f6;
}

.dark-theme .member-email {
  color: #d1d5db;
}

.dark-theme .add-member-form {
  background: #4b5563;
  border-color: #6b7280;
}

.dark-theme .empty-networks {
  color: #9ca3af;
}

.dark-theme .empty-networks-icon {
  color: #6b7280;
}

/* Contact Picker */
.dark-theme .search-box input {
  background: #4b5563;
  border-color: #6b7280;
  color: #f3f4f6;
}

.dark-theme .search-box input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
}

.dark-theme .search-icon {
  color: #d1d5db;
}

.dark-theme .contact-suggestions {
  background: #374151;
  border-color: #4b5563;
}

.dark-theme .contact-item {
  border-bottom-color: #4b5563;
}

.dark-theme .contact-item:hover {
  background-color: #4b5563;
}

.dark-theme .contact-item.selected {
  background-color: #1e3a8a;
  border-left-color: #60a5fa;
}

.dark-theme .contact-name {
  color: #f3f4f6;
}

.dark-theme .contact-email {
  color: #d1d5db;
}

.dark-theme .recent-contacts h6,
.dark-theme .selected-contacts h6 {
  color: #d1d5db;
}

.dark-theme .selected-contact-item {
  background: #065f46;
  border-color: #10b981;
}

.dark-theme .empty-contacts,
.dark-theme .no-results {
  color: #9ca3af;
}




/* Main CSS entry point */

/* Critical above-the-fold styles */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-background);
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.app-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--color-background);
}

.error-content {
  text-align: center;
  max-width: 500px;
}

.error-content h2 {
  color: var(--color-error);
  margin-bottom: 1rem;
}

.error-content p {
  margin-bottom: 2rem;
  color: var(--color-text-secondary);
}
