/* =============================================================================
   The Content Vault - Clean Styles
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Reset and Base Styles
   ----------------------------------------------------------------------------- */
   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* -----------------------------------------------------------------------------
   CSS Variables - Design System
   ----------------------------------------------------------------------------- */
:root {
    /* Colors */
    --primary-color: #007AFF;
    --primary-hover: #1557b0;
    --secondary-color: #5f6368;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;
    
    /* iOS Native Colors */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-orange: #FF9500;
    --ios-red: #FF3B30;
    --ios-purple: #AF52DE;
    --ios-pink: #FF2D92;
    --ios-teal: #5AC8FA;
    --ios-indigo: #5856D6;
    
    /* Surfaces */
    --background-color: #F2F2F7;
    --surface-color: #FFFFFF;
    --surface-secondary: #F1F3F4;
    --surface-hover: #e8f0fe;
    --ios-background: #F2F2F7;
    --ios-secondary-background: #FFFFFF;
    --ios-tertiary-background: #F2F2F7;
    
    /* Text */
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    
    /* Borders */
    --border-color: #e8eaed;
    --border-hover: #dadce0;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-md: 0 1px 2px 0 rgba(60,64,67,0.3), 0 2px 6px 2px rgba(60,64,67,0.15);
    --shadow-lg: 0 4px 8px 3px rgba(60,64,67,0.15), 0 1px 3px rgba(60,64,67,0.3);
    --ios-shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --ios-shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
    --ios-shadow-heavy: 0 8px 25px rgba(0, 0, 0, 0.2);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --ios-radius-small: 8px;
    --ios-radius-medium: 12px;
    --ios-radius-large: 16px;
    --ios-radius-xlarge: 20px;
    
    /* Blur Effects */
    --ios-blur-light: rgba(255, 255, 255, 0.8);
    --ios-blur-dark: rgba(0, 0, 0, 0.4);
}

/* -----------------------------------------------------------------------------
   Typography and Base Elements
   ----------------------------------------------------------------------------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    background: var(--ios-background);
    color: var(--text-primary);
    line-height: 1.47;
    font-size: 17px;
    letter-spacing: -0.41px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* -----------------------------------------------------------------------------
   Layout Components
   ----------------------------------------------------------------------------- */

/* Container */
.container {
    max-width: 100%;
    margin: 0;
    background: var(--ios-background);
    min-height: 100vh;
}

/* Content Area */
.content {
    padding: 16px;
    background: #f5f5f5;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* -----------------------------------------------------------------------------
   Authentication Screen
   ----------------------------------------------------------------------------- */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
}

.auth-header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.auth-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.auth-header p {
    font-size: 1.125rem;
    opacity: 0.9;
    font-weight: 300;
}

.auth-content {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
}

.auth-description {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.features-list {
    list-style: none;
    margin-bottom: 2rem;
}

.features-list li {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.features-list li:before {
    content: "✓";
    color: var(--success-color);
    font-weight: bold;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.google-signin-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.google-signin-btn:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.google-icon {
    width: 20px;
    height: 20px;
}

.security-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
}

/* -----------------------------------------------------------------------------
   Header Component
   ----------------------------------------------------------------------------- */
   .header {
    background: linear-gradient(135deg, var(--ios-blue) 0%, #1557b0 100%);
    color: white;
    margin-top: env(safe-area-inset-top, 0px);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    border-bottom: 0.5px solid rgba(255,255,255,0.2);
    flex-wrap: nowrap;
}

/* App Logo */
.app-logo {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.app-logo:hover {
    transform: scale(1.1);
}

.app-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* Header Title */
.header-title {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.header-title h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.45px;
    line-height: 1.2;
    color: white;
}

.header-title p {
    font-size: 14px;
    margin: 0;
    line-height: 1.2;
    color: white;
    opacity: 0.9;
}

/* User Avatar */
.user-avatar-compact {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: white;
}

.user-avatar-compact:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.user-avatar-compact:active {
    transform: scale(0.95);
}

/* Sign Out Button */
.sign-out-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.sign-out-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sign-out-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sign-out-btn:active {
    transform: scale(0.95);
}

/* Auth Logo */
.auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* User Info Popover */
.user-info-popover {
    position: absolute;
    top: 60px;
    right: 20px;
    background: var(--ios-secondary-background);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--ios-shadow-heavy);
    z-index: 1000;
    display: none;
    min-width: 200px;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
}

.user-info-popover.visible {
    display: block;
    animation: popoverAppear 0.3s ease-out;
}

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

.user-info-popover p {
    margin: 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.user-info-popover small {
    color: var(--text-secondary);
    font-size: 12px;
}

.user-info-popover-signout {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 8px;
}

.user-info-popover-signout button {
    flex: 1;
    padding: 8px 12px;
    background: var(--ios-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-info-popover-signout button:hover {
    background: #0051D5;
}

.user-info-popover-signout button:active {
    transform: scale(0.95);
}

/* -----------------------------------------------------------------------------
   Navigation Components
   ----------------------------------------------------------------------------- */

/* Desktop Tabs */
.tabs {
    display: flex;
    background: var(--ios-secondary-background);
    border-radius: var(--ios-radius-large);
    padding: 4px;
    margin-bottom: 2rem;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    box-shadow: var(--ios-shadow-light);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--ios-radius-medium);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
    flex: 1;
    text-align: center;
    min-width: 120px;
    letter-spacing: -0.32px;
}

.tab:hover {
    color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.05);
}

.tab.active {
    color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.1);
    box-shadow: var(--ios-shadow-light);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block !important;
    visibility: visible !important;
}

/* Add a loading state for the app screen */
.app-screen.loading .tab-content {
    display: none !important;
}

/* Mobile Bottom Tab Navigation */
.mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    padding-top: 8px;
    /* Add safe area inset for PWA mode (home indicator on iOS) */
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    display: none;
    z-index: 1000;
}

.mobile-tabs {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    min-width: 60px;
    background: none;
    border: none;
    color: var(--text-secondary);
}

.mobile-tab.active {
    color: var(--ios-blue);
}

.mobile-tab:active {
    transform: scale(0.95);
    background: rgba(0, 122, 255, 0.1);
}

.mobile-tab-icon {
    width: 24px;
    height: 24px;
}

.mobile-tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.24px;
}

/* -----------------------------------------------------------------------------
   Button Components
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ios-blue);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--ios-radius-medium);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
    line-height: 1.2;
    min-height: 44px;
    box-shadow: var(--ios-shadow-light);
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn:hover:before {
    opacity: 1;
}

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

.btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--ios-shadow-light);
}

.btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Button Variants */
.btn-success {
    background: var(--ios-green);
}

.btn-secondary {
    background: var(--ios-secondary-background);
    color: var(--ios-blue);
    border: 1px solid var(--ios-blue);
    box-shadow: var(--ios-shadow-light);
}

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

.btn-warning {
    background: var(--ios-orange);
}

.btn-small {
    padding: 8px 16px;
    font-size: 15px;
    min-height: 36px;
    border-radius: var(--ios-radius-small);
}

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

.btn-outline:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
    transform: none;
}

/* Specific Button Types */
.create-share-btn {
    background: var(--success-color);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--ios-radius-medium);
    box-shadow: var(--ios-shadow-light);
}

.approval-action-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.approval-action-btn.change-request {
    background: var(--ios-blue);
}

.approval-action-btn.brand-approval {
    background: var(--success-color);
}

/* Timeline Mode Button States */
.btn.active {
    background: var(--success-color);
    color: white;
}

.btn.active:hover {
    background: #0f7d2f;
}

/* -----------------------------------------------------------------------------
   Form Components
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.41px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--ios-secondary-background);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--ios-radius-medium);
    padding: 16px;
    font-size: 17px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: var(--ios-shadow-light);
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
    transform: scale(1.01);
}

.form-group input:disabled,
.form-group textarea:disabled,
.form-group select:disabled {
    background: var(--surface-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group-prefix {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-right: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-height: 44px;
}

.input-group input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
    flex: 1;
}

/* Checkbox Items */
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin-top: 0.125rem;
    accent-color: var(--primary-color);
}

/* -----------------------------------------------------------------------------
   Upload Components
   ----------------------------------------------------------------------------- */

/* Desktop Upload Zone */
.upload-zone {
    border: 2px dashed rgba(0, 122, 255, 0.3);
    border-radius: var(--ios-radius-xlarge);
    padding: 48px 24px;
    text-align: center;
    background: var(--ios-secondary-background);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-bottom: 24px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--ios-shadow-light);
}

.upload-zone:hover {
    border-color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.05);
    box-shadow: var(--ios-shadow-medium);
    transform: scale(1.02);
}

.upload-zone.dragover {
    border-color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.1);
    box-shadow: var(--ios-shadow-heavy);
    transform: scale(1.03);
}

.upload-zone h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.45px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
    font-weight: 500;
    letter-spacing: -0.32px;
}

.upload-zone input[type="file"] {
    display: none;
}

/* Mobile Upload Zone */
.upload-zone-mobile {
    background: white;
    border: 2px dashed var(--ios-blue);
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    margin: 16px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.upload-zone-mobile:hover {
    border-color: var(--primary-hover);
    background: rgba(0, 122, 255, 0.05);
    transform: scale(1.02);
}

.upload-zone-mobile:active {
    transform: scale(0.98);
}

.upload-icon {
    color: var(--ios-blue);
    margin-bottom: 8px;
}

.upload-zone-mobile h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.upload-zone-mobile p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Upload Mode Section */
.upload-mode-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.upload-mode-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mode-option {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-color);
    position: relative;
    display: block;
}

.mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

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

.mode-option.active {
    border-color: var(--primary-color);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}

.mode-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.mode-icon {
    width: 40px;
    height: 40px;
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mode-option.active .mode-icon {
    background: var(--primary-color);
    color: white;
}

.mode-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.mode-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.4;
}

/* Intent Options */
.upload-intent-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.upload-intent-section label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.intent-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.intent-option {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
    display: block;
}

.intent-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

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

.intent-option:has(input:checked) {
    border-color: var(--primary-color);
    background: var(--surface-hover);
}

.intent-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.intent-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

/* Access Mode Options */
.access-mode-option {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-color);
    position: relative;
    display: block;
    text-align: center;
}

.access-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.access-mode-option:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.access-mode-option:has(input:checked) {
    border-color: var(--primary-color);
    background: var(--surface-hover);
}

.access-mode-content strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.access-mode-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    line-height: 1.3;
}

/* -----------------------------------------------------------------------------
   Organization and Control Components
   ----------------------------------------------------------------------------- */

/* Organization Controls */
.organization-controls,
.organization-section {
    background: var(--ios-secondary-background);
    border-radius: var(--ios-radius-large);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--ios-shadow-light);
}

.organization-header {
    padding: 20px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
}

.organization-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.41px;
}

.organization-body,
.mobile-controls-grid {
    padding: 20px;
    display: grid;
    gap: 16px;
}

.control-section,
.org-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.org-row:last-child {
    margin-bottom: 0;
}

.control-label,
.org-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    letter-spacing: -0.32px;
}

.folder-controls,
.folder-selector-group,
.tags-selector-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.folder-controls select,
.folder-selector-group select,
.tags-selector-group select,
.org-control {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--ios-radius-medium);
    background: var(--ios-secondary-background);
    font-size: 16px;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 16px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 48px;
    box-sizing: border-box;
}

.new-folder-btn,
.new-tag-btn {
    background: var(--ios-blue);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--ios-radius-medium);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    transition: all 0.2s ease;
}

.new-folder-btn:hover,
.new-tag-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Search Controls */
.mobile-search-filter,
.search-input-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
    position: relative;
}

.search-input {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--ios-radius-medium);
    background: var(--ios-secondary-background);
    font-size: 16px;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

.search-input-wrapper .search-input {
    padding-left: 48px !important;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    z-index: 2;
    pointer-events: none;
}

/* View Toggle */
.view-toggle-mobile,
.view-controls {
    display: flex;
    background: var(--surface-secondary);
    border-radius: var(--ios-radius-medium);
    padding: 4px;
    gap: 4px;
}

.view-btn-mobile,
.view-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    border-radius: var(--ios-radius-small);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn-mobile.active,
.view-btn.active {
    background: var(--ios-blue);
    color: white;
    box-shadow: var(--ios-shadow-light);
}

.view-btn:hover:not(.active) {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Tags Section */
.tags-section {
    background: var(--surface-secondary);
    border-radius: var(--ios-radius-medium);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.quick-tags-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.quick-tag,
.common-tag {
    background: var(--ios-secondary-background);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--ios-radius-small);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.quick-tag.selected,
.common-tag.selected {
    background: var(--ios-blue);
    color: white;
    border-color: var(--ios-blue);
}

.quick-tag:active,
.common-tag:hover {
    transform: scale(0.95);
}

.custom-tag-input {
    display: flex;
    gap: 8px;
}

.custom-tag-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--ios-radius-small);
    font-size: 14px;
}

.add-tag-btn {
    background: var(--ios-blue);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--ios-radius-small);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* -----------------------------------------------------------------------------
   File Display Components
   ----------------------------------------------------------------------------- */

/* File List Container */
.file-list {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 40px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border-color);
}

.file-list-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.file-count {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* Content Library Section */
.content-library-section {
    background: white;
    border-radius: 16px;
    margin: 16px 0;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.content-library-header {
    padding: 20px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.content-library-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* File Grid View */
#fileListContainer,
.files-grid {
    min-height: 200px !important;
    display: block !important;
}

/* File Grid View - Fixed Layout */
#fileListContainer.files-grid,
.files-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 16px !important;
    padding: 20px !important;
    background: white !important;
    padding-bottom: 40px !important;
}

/* Mobile file grid adjustments */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    #fileListContainer.files-grid,
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
        gap: 12px !important;
        padding: 12px !important;
    }
}

.file-card {
    display: flex;
    flex-direction: column;
    background: var(--ios-secondary-background);
    border: none;
    border-radius: var(--ios-radius-large);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    height: fit-content;
    position: relative;
    box-shadow: var(--ios-shadow-light);
}

.file-card:hover {
    box-shadow: var(--ios-shadow-heavy);
    transform: translateY(-2px) scale(1.01);
}

.file-card:active {
    transform: translateY(0) scale(0.98);
    transition: transform 0.1s ease;
}

.file-card:last-child {
    margin-bottom: 40px;
}

.file-preview-thumb {
    height: 160px;
    background: var(--ios-tertiary-background);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}

.file-preview-thumb img,
.file-preview-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.file-icon {
    color: var(--text-secondary);
}

.file-icon svg {
    width: 32px;
    height: 32px;
}

.file-card-content {
    padding: 16px;
    background: var(--ios-secondary-background);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.file-card-title,
.file-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 42px;
    line-clamp: 2;
}

.file-title {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    min-height: 1.2em !important;
    -webkit-line-clamp: 1 !important;
    line-height: 1.2;
    line-clamp: 1;
}

.title-text {
    flex: 1;
    word-break: break-word;
}

.expand-title-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.expand-title-btn:hover {
    color: var(--primary-hover);
}

.file-card-meta {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
    font-weight: 500;
}

.file-card-meta svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.8;
}

.file-card-tags {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    min-height: 20px;
}

.file-tag {
    background: var(--surface-secondary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.file-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.file-card:hover .file-card-actions {
    opacity: 1;
    transform: translateY(0);
}

.file-card-actions .btn {
    padding: 6px 8px;
    font-size: 12px;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.file-card-actions .btn:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.file-card-actions .btn svg {
    width: 12px;
    height: 12px;
}

/* IMPROVED LIST VIEW LAYOUT */
#fileListContainer.files-list,
.files-list {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: white;
}

.files-list .file-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    gap: 16px;
    background: var(--surface-color);
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 80px;
}

.files-list .file-item:last-child {
    border-bottom: none;
}

.files-list .file-item:hover {
    background: var(--surface-hover);
}

.files-list .file-item:hover .file-actions {
    opacity: 1;
    transform: translateY(0);
}

/* CHECKBOX AND MAIN CONTENT AREA */
.files-list .file-item .checkbox-item {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-right: 16px;
}

.files-list .file-item .checkbox-item input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* THUMBNAIL AND FILE INFO CONTAINER */
.files-list .file-item .checkbox-item > div {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* FILE INFO SECTION */
.files-list .file-item .file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.files-list .file-item .file-info strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    max-width: 100%;
}

.files-list .file-item .file-info small {
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
    flex-wrap: wrap;
}

.files-list .file-item .file-info small svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.files-list .file-item .file-tags {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ACTIONS CONTAINER - RIGHT SIDE */
.files-list .file-item > div:last-child {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    min-width: 200px;
}

.files-list .file-item .file-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-top: 0;
    max-width: 200px;
}

.files-list .file-item .file-actions button {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    min-width: 32px;
}

.files-list .file-item .file-actions button svg {
    width: 12px;
    height: 12px;
}

/* CREATE SHARE BUTTON */
.files-list .file-item .create-share-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 32px;
    width: 100%;
    max-width: 200px;
    justify-content: center;
    margin-top: 0;
}

/* MOBILE SPECIFIC FIXES */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    .files-list .file-item {
        padding: 16px 12px;
        gap: 12px;
        min-height: 100px;
        align-items: flex-start;
    }

    .files-list .file-item .checkbox-item {
        gap: 12px;
        padding-right: 8px;
    }

    .files-list .file-item .checkbox-item input[type="checkbox"] {
        margin-top: 4px;
    }

    .files-list .file-item .file-info strong {
        font-size: 15px;
        white-space: normal;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-clamp: 2;
    }

    .files-list .file-item .file-info small {
        font-size: 12px;
    }

    .files-list .file-item > div:last-child {
        min-width: 120px;
        align-items: flex-end;
    }

    .files-list .file-item .file-actions {
        opacity: 1;
        transform: none;
        max-width: 120px;
        justify-content: flex-end;
    }

    .files-list .file-item .file-actions button {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 28px;
        min-width: 28px;
    }

    .files-list .file-item .create-share-btn {
        font-size: 11px;
        padding: 6px 8px;
        max-width: 120px;
    }
}

/* MOBILE PORTRAIT MODE FIXES FOR LIST VIEW */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    .files-list .file-item {
        padding: 16px 12px;
        gap: 12px;
        min-height: 120px; /* Increased height */
        align-items: flex-start;
        flex-direction: column; /* Stack vertically on mobile */
    }

    .files-list .file-item .checkbox-item {
        gap: 12px;
        padding-right: 0;
        width: 100%;
        margin-bottom: 8px;
    }

    .files-list .file-item .checkbox-item input[type="checkbox"] {
        margin-top: 4px;
    }

    .files-list .file-item .file-info strong {
        font-size: 15px;
        white-space: normal;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 6px;
        line-clamp: 2;
    }

    .files-list .file-item .file-info small {
        font-size: 12px;
        line-height: 1.4;
        margin-bottom: 4px;
    }

    /* ACTIONS CONTAINER - FULL WIDTH ON MOBILE */
    .files-list .file-item > div:last-child {
        width: 100%;
        min-width: unset;
        align-items: stretch;
        margin-top: 8px;
    }

    .files-list .file-item .file-actions {
        opacity: 1;
        transform: none;
        width: 100%;
        justify-content: space-between;
        max-width: unset;
        margin-bottom: 8px;
    }

    .files-list .file-item .file-actions button {
        padding: 8px;
        font-size: 0; /* Hide text, show only icons */
        min-height: 36px;
        min-width: 36px;
        width: 36px;
        border-radius: 8px;
        flex: 0 0 36px;
    }

    .files-list .file-item .file-actions button svg {
        width: 16px;
        height: 16px;
    }

    .files-list .file-item .create-share-btn {
        font-size: 13px;
        padding: 10px 16px;
        max-width: unset;
        width: 100%;
        text-align: center;
        min-height: 40px;
    }
}

/* LANDSCAPE MODE ADJUSTMENTS */
@media (max-width: 768px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
    .files-list .file-item {
        flex-direction: row; /* Back to horizontal in landscape */
        min-height: 80px;
        align-items: center;
    }

    .files-list .file-item .checkbox-item {
        margin-bottom: 0;
        width: auto;
        flex: 1;
    }

    .files-list .file-item > div:last-child {
        width: auto;
        min-width: 160px;
        margin-top: 0;
        align-items: flex-end;
    }

    .files-list .file-item .file-actions {
        justify-content: flex-end;
        margin-bottom: 4px;
    }

    .files-list .file-item .file-actions button {
        font-size: 0;
        width: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .files-list .file-item .create-share-btn {
        font-size: 11px;
        padding: 6px 12px;
        max-width: 160px;
    }
}

/* TABLET SPECIFIC ADJUSTMENTS */
@media (min-width: 769px) and (max-width: 1024px) {
    .files-list .file-item {
        padding: 14px 16px;
    }

    .files-list .file-item .checkbox-item {
        gap: 14px;
    }

    .files-list .file-item > div:last-child {
        min-width: 180px;
    }

    .files-list .file-item .file-actions {
        max-width: 180px;
    }

    .files-list .file-item .create-share-btn {
        max-width: 180px;
    }
}

/* File Replacement Section */
.file-replacement-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.file-replacement-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.replacement-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.replaceable-files-list {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.replaceable-file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

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

.replaceable-file-item:hover {
    background: var(--surface-hover);
}

.replaceable-file-item input[type="checkbox"] {
    margin-right: 0.75rem;
    accent-color: var(--primary-color);
}

.replaceable-file-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-needs-revision {
    background: #fef2f2;
    color: #991b1b;
}

.replaceable-file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.replaceable-file-meta {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-left: auto;
}

/* -----------------------------------------------------------------------------
   Bulk Actions
   ----------------------------------------------------------------------------- */
.bulk-actions,
.bulk-actions-mobile {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: none;
}

.bulk-actions.visible,
.bulk-actions-mobile.visible {
    display: block;
}

.bulk-actions-mobile {
    background: white;
    border-radius: 16px;
    margin: 16px 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

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

.bulk-actions-header span {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.bulk-actions-buttons,
.bulk-actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bulk-actions-mobile .bulk-actions-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.select-all-btn,
.select-all-shares-btn,
.bulk-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bulk-btn {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

.select-all-btn:hover,
.select-all-shares-btn:hover {
    background: #475569;
}

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

.bulk-btn-secondary {
    background: var(--ios-red);
    color: white;
}

.bulk-btn-outline {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.bulk-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.bulk-btn:active {
    transform: translateY(0);
}

/* Tag Controls */
.tag-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.tag-input {
    min-width: 150px;
}

/* Filter Tags Group */
.filter-tags-group {
    display: flex;
    gap: 8px;
}

.filter-tags-group select {
    flex: 1;
}

/* -----------------------------------------------------------------------------
   Analytics and Statistics
   ----------------------------------------------------------------------------- */
.stat-card,
.analytics-card {
    background: white;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: left;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.stat-number,
.analytics-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--ios-blue);
    margin-bottom: 4px;
    line-height: 1;
}

.stat-label,
.analytics-label {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    justify-content: center;
}

/* Activity Sections */
.activity-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.activity-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.125rem;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 1rem;
    font-size: 1.25rem;
}

.activity-content {
    flex: 1;
}

.activity-content strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.activity-content small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.activity-stats {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Charts and Placeholders */
.chart-placeholder {
    background: linear-gradient(135deg, var(--surface-secondary), white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 2rem;
}

/* Trending Content */
.trending-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.trending-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.trending-rank {
    background: var(--success-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
}

.trending-content {
    flex: 1;
}

.trending-metrics {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Distribution and Insights */
/* CONTENT DISTRIBUTION - PROPER SPACING TO AVOID OVERLAP */
.distribution-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin-bottom: 20px; /* Increased spacing between items */
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.distribution-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px; /* Increased margin for better separation */
    padding: 0 4px; /* Add small padding to prevent edge touching */
}

.distribution-type {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px; /* Add gap between dot and text */
    flex: 1;
    min-width: 0;
}

.distribution-type::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.distribution-count {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    background: var(--surface-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 12px; /* Ensure separation from label */
}

.distribution-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
    margin-top: 4px; /* Add small gap above progress bar */
}

.distribution-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* Keep the color definitions the same */
.distribution-fill.images { 
    background: linear-gradient(90deg, #3b82f6, #1d4ed8); 
}
.distribution-fill.videos { 
    background: linear-gradient(90deg, #10b981, #059669); 
}
.distribution-fill.documents { 
    background: linear-gradient(90deg, #f59e0b, #d97706); 
}
.distribution-fill.other { 
    background: linear-gradient(90deg, #8b5cf6, #7c3aed); 
}

.distribution-item:nth-child(1) .distribution-type::before { 
    background: linear-gradient(135deg, #3b82f6, #1d4ed8); 
}
.distribution-item:nth-child(2) .distribution-type::before { 
    background: linear-gradient(135deg, #10b981, #059669); 
}
.distribution-item:nth-child(3) .distribution-type::before { 
    background: linear-gradient(135deg, #f59e0b, #d97706); 
}
.distribution-item:nth-child(4) .distribution-type::before { 
    background: linear-gradient(135deg, #8b5cf6, #7c3aed); 
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.insight-card {
    background: var(--surface-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.insight-metric {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.insight-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.insight-trend {
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 500;
}

.insight-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Storage Information */
.storage-list {
    margin-top: 1rem;
}

.storage-item {
    margin-bottom: 1.5rem;
}

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

.storage-folder {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.storage-size {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.storage-bar {
    height: 8px;
    background: var(--surface-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.6s ease;
}

.storage-fill.raw { background: linear-gradient(90deg, #ef4444, #dc2626); }
.storage-fill.finished { background: linear-gradient(90deg, #10b981, #059669); }
.storage-fill.assets { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }

/* -----------------------------------------------------------------------------
   Video Timeline Components
   ----------------------------------------------------------------------------- */
.video-modal-content {
    max-height: 95vh;
}

.video-modal-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.video-container,
.video-player-container {
    position: relative;
    margin-bottom: 1rem;
    padding: 1.5rem;
    background: var(--surface-color);
    margin: 0;
}

.video-player-container .preview-video {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
    max-height: 60vh;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.video-time-display {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    pointer-events: none;
}

.video-controls-section {
    background: white;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

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

.controls-header h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.current-time-display {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.video-timeline-container {
    background: var(--surface-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

.timeline-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* Timeline Comments Overlay */
.timeline-comments-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem;
    border-radius: 0 0 8px 8px;
}

.timeline-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin: 0.5rem 0;
    cursor: pointer;
}

.timeline-bar:hover {
    background: rgba(255, 255, 255, 0.4);
}

.timeline-current-indicator {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 10px;
    background: #fff;
    border-radius: 1px;
    pointer-events: none;
    transition: left 0.1s ease;
}

.timeline-marker {
    position: absolute;
    top: -4px;
    width: 14px;
    height: 14px;
    background: #ff4757;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transform: translateX(-50%);
    transition: all 0.2s ease;
    z-index: 10;
}

.timeline-marker:hover {
    transform: translateX(-50%) scale(1.2);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

.timeline-marker::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #ff4757;
}

.timeline-marker:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-bottom: 8px;
    z-index: 1000;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}

/* Timeline Comments Panel */
.timeline-comments-panel {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.timeline-comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline-comments-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.timeline-comments-list {
    max-height: 200px;
    overflow-y: auto;
}

.timeline-comment-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.timeline-comment-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-hover);
}

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

.timeline-timestamp-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    font-family: monospace;
    flex-shrink: 0;
}

.timeline-timestamp-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.comment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.comment-meta strong {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: right;
}

.comment-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: right;
}

.timeline-comment-text {
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--surface-secondary);
    margin-top: 0.5rem;
}

.timeline-comment-author {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.timeline-comment-time {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Timeline Form Components */
.timestamp-comment-form {
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

.form-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    margin: 0;
}

.form-header h5 {
    color: white;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    padding: 1.5rem;
}

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

.half-width {
    margin-bottom: 0 !important;
}

.form-actions {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Video Timeline Modal Specific */
.video-timeline-modal .file-modal-content,
.video-timeline-modal .preview-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.video-timeline-modal .message {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 300px;
    box-shadow: var(--shadow-lg);
}

/* Empty State for Timeline Comments */
.timeline-comments-list .empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.timeline-comments-list .empty-state p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.timeline-comments-list .empty-state small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* -----------------------------------------------------------------------------
   Settings Components
   ----------------------------------------------------------------------------- */
   .settings-page {
    padding-bottom: 120px;
}

.settings-actions,
.settings-footer {
    /* Normal static positioning - no floating */
    position: static;
    background: transparent;
    padding: 0;
    margin: 0;
    border-top: none;
    display: flex;
    gap: 12px;
}

.settings-actions .btn,
.settings-footer .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Messages and States
   ----------------------------------------------------------------------------- */
   .message {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
    /* Fixed positioning with safe area support for PWA mode */
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 20px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    min-width: 300px;
    max-width: 90vw;
    text-align: center;
}

.message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Loading and Empty States */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.error-state {
    text-align: center;
    padding: 3rem;
    color: var(--danger-color);
    background: #fef2f2;
    border-radius: var(--radius-lg);
    border: 1px solid #fecaca;
}

/* Progress Bars */
.progress-bar {
    background: var(--surface-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 8px;
    margin-top: 0.5rem;
}

.progress-fill {
    background: var(--success-color);
    height: 100%;
    transition: width 0.3s ease;
}

/* Expiry Badges */
.expiry-badge {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.expiry-active {
    background: var(--success-color);
    color: white;
}

.expiry-warning {
    background: var(--warning-color);
    color: white;
}

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

/* Existing Share Options */
.existing-share-options {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* -----------------------------------------------------------------------------
   iOS-style Animations
   ----------------------------------------------------------------------------- */
@keyframes ios-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(100px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(-10px);
    }
    70% {
        transform: scale(0.9) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes ios-fade-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ios-scale-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ios-animate-in {
    animation: ios-bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-fade-up {
    animation: ios-fade-up 0.4s ease-out;
}

.ios-scale-in {
    animation: ios-scale-in 0.3s ease-out;
}

/* -----------------------------------------------------------------------------
   Responsive Design
   ----------------------------------------------------------------------------- */

/* Tablet and Small Desktop */
@media (max-width: 1024px) {
    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Devices */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    /* Hide desktop tabs, show mobile tabs */
    .tabs {
        display: none;
    }
    
    .mobile-tab-bar {
        display: block;
    }
    
    /* Hide desktop upload zone, show mobile version */
    .upload-zone:not(.upload-zone-mobile) {
        display: none;
    }
    
    /* IMPROVED HEADER LAYOUT */
    .header {
        /* Push header below status bar/notch area on mobile */
        margin-top: env(safe-area-inset-top, 0px);
        padding-top: 20px;
        padding-left: 20px;
        padding-right: 20px;
        padding-bottom: 30px;
        min-height: 100px;
        display: grid;
        grid-template-columns: 50px 1fr 80px;
        align-items: center;
        gap: 12px;
    }

    .user-avatar-compact {
        position: static;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
        justify-self: start;
    }

    /* App Logo */
    .app-logo {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        flex-shrink: 0;
        transition: transform 0.2s ease;
    }

    .app-logo img {
        width: 48px;
        height: 48px;
    }

    /* Updated Header Layout */
    .header {
        display: flex;
        align-items: center;
        gap: 16px;
        flex-wrap: nowrap;
    }

    .header-title {
        flex: 1;
        text-align: center;
    }

    .header-title {
        position: static;
        transform: none;
        text-align: center;
        justify-self: center;
    }

    .header-title h1 {
        font-size: 24px;
        margin: 0 0 2px 0;
        line-height: 1.2;
        font-weight: 600;
    }

    .header-title p {
        font-size: 14px;
        margin: 0;
        line-height: 1.2;
    }

    .sign-out-btn {
        position: static;
        padding: 6px 10px;
        font-size: 13px;
        flex-shrink: 0;
        justify-self: end;
    }
    
    /* Content adjustments */
    .content {
        padding: 12px;
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
        margin-top: 8px;
        box-sizing: border-box;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Prevent horizontal overflow */
    * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Button and input adjustments */
    .btn, button, input, select, textarea {
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 14px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* SEARCH INPUTS */
    .search-input-wrapper {
        position: relative;
        width: 100%;
    }
    
    .search-input,
    .org-control {
        padding: 14px 16px 14px 44px;
        height: 48px;
        line-height: 1.4;
        font-size: 16px;
        box-sizing: border-box;
        width: 100%;
    }
    
    .search-input::placeholder,
    .org-control::placeholder,
    input::placeholder {
        font-size: 14px;
        opacity: 0.6;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .search-icon {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        pointer-events: none;
    }
    
    .org-control {
        padding-left: 16px;
        padding-right: 48px;
    }

    /* IMPROVED SHARES LAYOUT */
    .file-item {
        background: white;
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.08);
        border: 1px solid var(--border-color);
    }

    .file-item .checkbox-item {
        margin-bottom: 16px;
        align-items: flex-start;
        gap: 16px;
    }

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

    .file-item .file-info strong {
        font-size: 18px;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 8px;
        display: block;
    }

    .file-item .file-info small {
        font-size: 14px;
        line-height: 1.4;
        color: var(--text-secondary);
        display: block;
        margin-bottom: 4px;
    }

    /* HORIZONTAL BUTTON LAYOUT */
    .file-actions {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px !important;
        margin-top: 16px !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .file-actions button {
        padding: 10px !important;
        font-size: 0 !important;
        min-height: 40px !important;
        width: 40px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    .file-actions button svg {
        width: 16px !important;
        height: 16px !important;
        flex-shrink: 0 !important;
    }

    /* Hide button text but keep icons */
    .file-actions button span:not(svg) {
        display: none !important;
    }

    /* URL BOX STYLING */
    .file-item > div:last-child {
        background: var(--surface-secondary);
        padding: 16px;
        border-radius: 12px;
        font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
        font-size: 12px;
        word-break: break-all;
        margin-top: 16px;
        line-height: 1.4;
        border: 1px solid var(--border-color);
    }

    /* CONTENT DISTRIBUTION - PROPER SPACING */
    .distribution-item {
        display: flex;
        flex-direction: column;
        padding: 0;
        margin-bottom: 20px;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .distribution-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding: 0 4px;
    }

    .distribution-type {
        font-weight: 500;
        color: var(--text-primary);
        font-size: 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .distribution-type::before {
        content: '';
        width: 12px;
        height: 12px;
        border-radius: 50%;
        display: inline-block;
        flex-shrink: 0;
    }

    .distribution-count {
        font-weight: 600;
        color: var(--text-primary);
        font-size: 16px;
        background: var(--surface-secondary);
        padding: 4px 8px;
        border-radius: 6px;
        min-width: 32px;
        text-align: center;
        flex-shrink: 0;
        margin-left: 12px;
    }

    .distribution-bar {
        height: 6px;
        background: #e5e7eb;
        border-radius: 3px;
        overflow: hidden;
        width: 100%;
        margin-top: 4px;
    }

    .distribution-fill {
        height: 100%;
        border-radius: 3px;
        transition: width 0.6s ease;
    }

    .distribution-fill.images { 
        background: linear-gradient(90deg, #3b82f6, #1d4ed8); 
    }
    .distribution-fill.videos { 
        background: linear-gradient(90deg, #10b981, #059669); 
    }
    .distribution-fill.documents { 
        background: linear-gradient(90deg, #f59e0b, #d97706); 
    }
    .distribution-fill.other { 
        background: linear-gradient(90deg, #8b5cf6, #7c3aed); 
    }

    .distribution-item:nth-child(1) .distribution-type::before { 
        background: linear-gradient(135deg, #3b82f6, #1d4ed8); 
    }
    .distribution-item:nth-child(2) .distribution-type::before { 
        background: linear-gradient(135deg, #10b981, #059669); 
    }
    .distribution-item:nth-child(3) .distribution-type::before { 
        background: linear-gradient(135deg, #f59e0b, #d97706); 
    }
    .distribution-item:nth-child(4) .distribution-type::before { 
        background: linear-gradient(135deg, #8b5cf6, #7c3aed); 
    }

    /* FIX TEXT ORIENTATION */
    * {
        writing-mode: initial !important;
        text-orientation: initial !important;
    }

    p, span, div, h1, h2, h3, h4, h5, h6, strong, small {
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        direction: ltr !important;
    }
    
    /* Section spacing */
    .upload-mode-section,
    .organization-controls,
    .organization-section,
    .content-library-section,
    .file-list,
    .activity-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Form adjustments */
    .upload-mode-toggle {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .intent-options {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group-prefix {
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
    
    .input-group input {
        border-left: 1px solid var(--border-color);
        border-top: none;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
    
    /* Layout adjustments */
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .folder-selector,
    .search-filter {
        min-width: auto;
    }
    
    .file-card-actions {
        justify-content: center;
    }
    
    /* Stats and analytics */
    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Analytics cards - show all 6 in 2-column grid on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    /* Add padding to prevent touching screen edges */
        padding: 0 12px;
        margin-bottom: 20px;
    }

    /* Ensure all stat cards are consistent size and spacing */
    .stat-card,
    .analytics-card {
        padding: 20px 16px;
        margin-bottom: 0;
        min-height: 100px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .distribution-label {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Bulk actions */
    .bulk-actions-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .bulk-actions-buttons {
        justify-content: center;
    }
    
    /* Approval buttons */
    .approval-action-btn {
        font-size: 11px !important;
        padding: 6px 8px !important;
        min-width: 80px !important;
        max-width: 48% !important;
    }
    
    /* Timeline comments adjustments */
    .timeline-comments-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .timeline-comment-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .comment-meta {
        align-items: flex-start;
    }
    
    .comment-meta strong,
    .comment-time {
        text-align: left;
    }
    
    .timeline-timestamp-btn {
        align-self: flex-start;
        width: fit-content;
    }
    
    /* Form row adjustments */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .video-timeline-modal .preview-content {
        width: 95vw;
    }
    
    /* Ensure proper bottom spacing */
    .file-list {
        margin-bottom: 40px;
    }
    
    #fileListContainer {
        padding-bottom: 40px;
    }
    
    .file-card:last-child {
        margin-bottom: 40px;
    }
    
    .files-grid {
        padding-bottom: 40px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .auth-content {
        padding: 1.5rem;
    }
    
    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
}

/* Large Desktop */
@media (min-width: 769px) {
    .upload-zone-mobile {
        display: none;
    }
}

/* TABLET AND DESKTOP LIST VIEW FIXES */
@media (min-width: 769px) {
    /* FIX SEARCH ICON ALIGNMENT - ALL DEVICES */
    .search-input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
    }

    .search-input-wrapper .search-input {
        padding-left: 48px;
        height: 48px;
        display: flex;
        align-items: center;
    }

    .search-input-wrapper .search-icon {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        pointer-events: none;
        color: var(--text-muted);
    }

    /* ENSURE CONSISTENT SEARCH INPUT HEIGHT */
    .search-input,
    .org-control {
        height: 48px;
        display: flex;
        align-items: center;
        padding-top: 0;
        padding-bottom: 0;
    }

    /* FILES LIST VIEW - PROPER LAYOUT FOR UPLOAD TAB */
    #fileListContainer.files-list .file-item,
    .files-list .file-item {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 16px 20px !important;
        border-bottom: 1px solid var(--border-color) !important;
        transition: all 0.2s ease !important;
        gap: 20px !important;
        background: var(--surface-color) !important;
        margin-bottom: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        flex-direction: row !important;
    }

    #fileListContainer.files-list .file-item:last-child,
    .files-list .file-item:last-child {
        border-bottom: none !important;
    }

    #fileListContainer.files-list .file-item:hover,
    .files-list .file-item:hover {
        background: var(--surface-hover) !important;
    }

    #fileListContainer.files-list .file-item .checkbox-item,
    .files-list .file-item .checkbox-item {
        margin-bottom: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 16px !important;
        flex-direction: row !important;
    }

    #fileListContainer.files-list .file-item .checkbox-item input[type="checkbox"],
    .files-list .file-item .checkbox-item input[type="checkbox"] {
        margin-top: 0 !important;
        flex-shrink: 0 !important;
        width: 18px !important;
        height: 18px !important;
    }

    #fileListContainer.files-list .file-item .file-info,
    .files-list .file-item .file-info {
        flex: 1 !important;
        min-width: 0 !important;
    }

    #fileListContainer.files-list .file-item .file-info strong,
    .files-list .file-item .file-info strong {
        color: var(--text-primary) !important;
        font-weight: 500 !important;
        font-size: 15px !important;
        display: block !important;
        margin-bottom: 4px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #fileListContainer.files-list .file-item .file-info small,
    .files-list .file-item .file-info small {
        color: var(--text-secondary) !important;
        font-size: 13px !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        line-height: 1.3 !important;
    }

    #fileListContainer.files-list .file-item .file-actions,
    .files-list .file-item .file-actions {
        display: flex !important;
        gap: 8px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        flex-wrap: nowrap !important;
        opacity: 0 !important;
        transform: translateY(10px) !important;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
        margin-top: 0 !important;
        flex-direction: row !important;
    }

    #fileListContainer.files-list .file-item:hover .file-actions,
    .files-list .file-item:hover .file-actions {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }

    #fileListContainer.files-list .file-item .file-actions button,
    .files-list .file-item .file-actions button {
        padding: 8px 12px !important;
        font-size: 12px !important;
        min-height: 32px !important;
        border-radius: 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        white-space: nowrap !important;
        width: auto !important;
    }

    #fileListContainer.files-list .file-item .file-actions button svg,
    .files-list .file-item .file-actions button svg {
        width: 14px !important;
        height: 14px !important;
    }

    /* CREATE SHARE BUTTON IN LIST VIEW */
    #fileListContainer.files-list .file-item .create-share-btn,
    .files-list .file-item .create-share-btn {
        margin-top: 8px !important;
        align-self: flex-end !important;
    }
}

/* =============================================================================
   TABLET MODE FIXES - ADD TO YOUR styles.css
   ============================================================================= */

/* FIX LIST VIEW LAYOUT ON TABLET */
@media (min-width: 769px) {
    /* FILES LIST VIEW - PROPER LAYOUT */
    .files-list .file-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        transition: all 0.2s ease;
        gap: 20px;
        background: var(--surface-color);
        margin-bottom: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .files-list .file-item:last-child {
        border-bottom: none;
    }

    .files-list .file-item:hover {
        background: var(--surface-hover);
    }

    .files-list .file-item .checkbox-item {
        margin-bottom: 0;
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .files-list .file-item .checkbox-item input[type="checkbox"] {
        margin-top: 0;
        flex-shrink: 0;
        width: 18px;
        height: 18px;
    }

    .files-list .file-item .file-info {
        flex: 1;
        min-width: 0;
    }

    .files-list .file-item .file-info strong {
        color: var(--text-primary);
        font-weight: 500;
        font-size: 15px;
        display: block;
        margin-bottom: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .files-list .file-item .file-info small {
        color: var(--text-secondary);
        font-size: 13px;
        display: flex;
        align-items: center;
        gap: 4px;
        line-height: 1.3;
    }

    .files-list .file-item .file-tags {
        margin-top: 4px;
        display: flex;
        gap: 4px;
        flex-wrap: wrap;
    }

    .files-list .file-item .file-actions {
        display: flex;
        gap: 8px;
        align-items: center;
        flex-shrink: 0;
        flex-wrap: nowrap;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        margin-top: 0;
    }

    .files-list .file-item:hover .file-actions {
        opacity: 1;
        transform: translateY(0);
    }

    .files-list .file-item .file-actions button {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 32px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        white-space: nowrap;
    }

    .files-list .file-item .file-actions button svg {
        width: 14px;
        height: 14px;
    }

    /* CREATE SHARE BUTTON IN LIST VIEW */
    .files-list .file-item .create-share-btn {
        margin-top: 8px;
        align-self: flex-end;
    }
}

/* FIX SEARCH ICON ALIGNMENT - ALL DEVICES */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-input {
    padding-left: 48px;
    height: 48px;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
    color: var(--text-muted);
}

/* ENSURE CONSISTENT SEARCH INPUT HEIGHT */
.search-input,
.org-control {
    height: 48px;
    display: flex;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}

/* FIX MODAL SCROLL POSITION ISSUE */
.modal {
    overflow-y: auto;
    scroll-behavior: auto;
}

.modal-content {
    margin: 40px auto;
    position: relative;
}

/* PREVENT BODY SCROLL JUMP WHEN MODAL OPENS/CLOSES */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
    top: 0;
    left: 0;
}

/* -----------------------------------------------------------------------------
   Modal Components
   ----------------------------------------------------------------------------- */

/* FIXED MODAL SYSTEM */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    overflow-y: auto;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    margin: auto;
    position: relative;
    /* PREVENT MOVEMENT */
    transform: none !important;
    transition: none !important;
    pointer-events: auto;
}

/* PREVENT BODY SCROLL AND POSITION JUMPING */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
    left: 0;
    right: 0;
}

/* MOBILE AND LANDSCAPE FIXES */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: max(env(safe-area-inset-top, 0px), 20px);
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 20px);
    }

    .modal-content {
        max-width: 100%;
        width: 100%;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px);
        margin: 0;
        /* LOCK POSITION ON MOBILE */
        position: static;
        transform: none !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
    }
}

/* LANDSCAPE ORIENTATION FIXES */
@media (orientation: landscape) and (max-height: 600px) {
    .modal {
        align-items: flex-start;
        padding: 10px;
    }

    .modal-content {
        max-height: calc(100vh - 20px);
        margin: 0 auto;
        /* PREVENT ANY MOVEMENT IN LANDSCAPE */
        position: static !important;
        transform: none !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
    }
}

/* MODAL HEADER IMPROVEMENTS */
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(135deg, var(--ios-blue) 0%, #1557b0 100%);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    gap: 20px;
    /* PREVENT HEADER FROM MOVING */
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
    text-align: left;
    /* PREVENT TEXT FROM CAUSING MOVEMENT */
    hyphens: auto;
    -webkit-hyphens: auto;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.8;
    /* PREVENT BUTTON FROM MOVING */
    position: relative;
    z-index: 2;
}

.close-modal:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* MODAL BODY AND FOOTER */
.modal-body {
    padding: 20px;
    overflow-x: hidden;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    /* STICK FOOTER TO BOTTOM */
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 1;
}

/* MOBILE MODAL ADJUSTMENTS */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    .modal-header {
        padding: 16px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 16px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* -----------------------------------------------------------------------------
   Brand Share Page Scroll Fix
   ----------------------------------------------------------------------------- */
   
/* Mobile responsive styles for brand.html */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        margin: 0;
    }
    
    .header {
        padding: 20px 15px;
    }
    
    .content-section {
        margin: 10px;
        padding: 15px;
    }
    
    /* Make sure text and buttons are appropriately sized */
    body {
        font-size: 16px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 16px;
    }
}