:root {
    --bg: #ffffff;
    --muted: #6b7280;
    --accent: #0077b6;
    --panel: #f7fafc;
    --card-border: #e6e9ee;
    --card-shadow: 0 6px 16px rgba(8, 21, 40, 0.06);
    --radius: 12px;
    --gap: 18px;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

#media_restriction_wrapper_div {
    display: flex;
    width: 100%;
    gap: var(--gap);
}

#media_restriction_wrapper_w30 {
    width: 30%;
    padding: 16px;
    background-color: #f5f7fa;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Collapsed sidebar state */
#media_restriction_wrapper_w30.collapsed {
    width: 60px;
    padding: 16px 8px;
}

#media_restriction_wrapper_w30.collapsed .mo_media_folder_sidebar_content {
    display: none;
}

#media_restriction_wrapper_w30.collapsed .mo_media_folder_sidebar_header h3 {
    display: none;
}

#media_restriction_wrapper_w30.collapsed hr {
    display: none;
}

#media_restriction_wrapper_w30.collapsed .mo_media_restriction_collapse_btn {
    width: 100%;
    justify-content: center;
    padding: 8px;
}

#media_restriction_wrapper_w30.collapsed .mo_media_collapse_menu_text {
    display: none;
}

#media_restriction_wrapper_w30.collapsed .mo_media_restriction_collapse_btn svg {
    transform: rotate(180deg);
}

/* When sidebar is collapsed, expand content area */
#media_restriction_wrapper_div:not([data-single-folder="true"]) #media_restriction_wrapper_w30.collapsed + #media_restriction_wrapper_w70 {
    width: calc(100% - 60px);
}

/* Folder sidebar header */
.mo_media_folder_sidebar_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e6e9ee;
}

.mo_media_folder_sidebar_header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #0b1220;
}

#media_restriction_wrapper_w30 hr {
    display: none;
}

.mo_media_restriction_collapse_btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #0077b6;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mo_media_restriction_collapse_btn:hover {
    background: #03679a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.3);
}

.mo_media_restriction_collapse_btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.mo_media_collapse_menu_text {
    white-space: nowrap;
}

.mo_media_folder_sidebar_content {
    transition: opacity 0.3s ease;
}

#media_restriction_wrapper_w70 {
    width: 70%;
    padding: 16px;
    background-color: #f5f7fa;
    border-radius: var(--radius);
}

/* Full width when sidebar is hidden (single folder view) */
#media_restriction_wrapper_w70.media_restriction_wrapper_full_width {
    width: 100%;
}

/* Hide sidebar when single folder view */
#media_restriction_wrapper_div[data-single-folder="true"] #media_restriction_wrapper_w30 {
    display: none;
}

/* Folder list styles */
#media_restriction_wrapper_w30 ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Modern File Library Header */
.mo_media_fbdl_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.mo_media_fbdl_title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mo_media_folder_icon {
    width: 36px;
    height: 36px;
    background: #0ea5a5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(14, 165, 165, 0.12);
}

.mo_media_folder_icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.mo_media_fbdl_title h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: #0b1220;
}

.mo_media_controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mo_media_controls label {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.mo_media_controls input[type=number] {
    width: 55px;
    padding: 5px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 13px;
    text-align: center;
    background: #fff;
}

.mo_media_view_toggle {
    display: flex;
    gap: 8px;
}

.mo_media_view_toggle button {
    border: 1px solid transparent;
    background: transparent;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
    min-width: 32px;
    min-height: 32px;
}

.mo_media_view_toggle button:hover {
    background: #f0f0f0;
    border-color: #e2e8f0;
}

.mo_media_view_toggle button.active {
    background: #fff;
    border-color: #e6e9ee;
    box-shadow: var(--card-shadow);
}

.mo_media_view_toggle button svg {
    pointer-events: none;
}

/* Header row for list view */
.mo_media_fbdl_head {
    display: grid;
    grid-template-columns: 1fr 90px 80px 130px 100px;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    background: #eef2f6;
    border-radius: 8px;
    color: #4b5563;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 10px;
}

/* Items list */
.mo_media_fbdl_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mo_media_fbdl_item {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--card-shadow);
    display: grid;
    grid-template-columns: 1fr 90px 80px 130px 100px;
    gap: 10px;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mo_media_fbdl_item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(8, 21, 40, 0.1);
}

.mo_media_file_title {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mo_media_file_thumb {
    width: 40px;
    height: 40px;
    background: #ffd6d6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.mo_media_file_thumb svg {
    width: 20px;
    height: 20px;
}

.mo_media_file_thumb svg path:first-child {
    fill: currentColor;
}

.mo_media_file_info {
    display: flex;
    flex-direction: column;
}

.mo_media_file_info .name {
    font-weight: 600;
    color: #0b1220;
    margin-bottom: 2px;
    font-size: 14px;
}

.mo_media_file_info .name a {
    color: #0b1220;
    text-decoration: none;
}

.mo_media_file_info .name a:hover {
    color: var(--accent);
}

.mo_media_file_link_disabled {
    color: #9ca3af !important;
    cursor: not-allowed !important;
    text-decoration: none;
    pointer-events: none;
    opacity: 0.7;
}

.mo_media_restricted {
    opacity: 0.8;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.mo_media_restricted .mo_media_file_link,
.mo_media_restricted .mo_media_file_link_disabled {
    pointer-events: none;
    cursor: not-allowed;
}

/* Prevent any interaction with restricted media items */
.mo_media_restricted * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mo_media_restricted a,
.mo_media_restricted .mo_media_file_link {
    pointer-events: none !important;
    cursor: not-allowed !important;
    color: #9ca3af !important;
}

.mo_media_file_info .meta {
    font-size: 12px;
    color: var(--muted);
}

.mo_media_fbdl_item .size,
.mo_media_fbdl_item .type,
.mo_media_fbdl_item .modified {
    text-align: center;
    color: #334155;
    font-size: 13px;
}

.mo_media_fbdl_item .type {
    color: var(--muted);
}

.mo_media_fbdl_item .modified {
    color: var(--muted);
}

.mo_media_download_col {
    text-align: center;
}

.mo_media_btn_download {
    background: linear-gradient(180deg, var(--accent) 0%, #03679a 100%);
    color: #fff;
    padding: 7px 14px;
    border-radius: 18px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block;
}

.mo_media_btn_download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
}

.mo_media_btn_download_disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    pointer-events: none;
}

.mo_media_btn_download_disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* File browser container */
.mo_media_fbdl {
    width: 100%;
}

/* Grid view */
.mo_media_fbdl.grid .mo_media_fbdl_list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.mo_media_fbdl.grid .mo_media_fbdl_item {
    grid-template-columns: 1fr;
    padding: 12px;
}

.mo_media_fbdl.grid .mo_media_file_title {
    margin-bottom: 8px;
}

.mo_media_fbdl.grid .mo_media_file_info .meta {
    display: none;
}

.mo_media_fbdl.grid .mo_media_fbdl_head {
    display: none;
}


/* Empty state styling - handled by PHP, but add fallback */
.mo_media_fbdl_list:empty::after {
    content: "No files in this folder. Click 'Add new media' to upload files.";
    display: block;
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 16px;
    grid-column: 1 / -1;
}

/* Ensure proper spacing for the main container */
#mo_media_restriction_frontend_ui_div {
    background: #f5f7fa;
    padding: 18px;
    border-radius: var(--radius);
}

/* Folder icon SVG styling */
.mo_media_folder_icon svg path {
    fill: currentColor;
}


.mo_media_restriction_white_div {
    background-color: white !important;
    max-width: none !important;
}

.mo_media_managment_frontend_heading_h2 {
    display: none; /* Hidden as we're using the new header design */
}

/* Responsive styles */
@media (max-width: 880px) {
    .mo_media_fbdl_head {
        display: none;
    }
    
    .mo_media_fbdl_item {
        grid-template-columns: 40px 1fr auto;
        gap: 8px;
        align-items: center;
        padding: 10px 12px;
    }
    
    .mo_media_fbdl_item .size,
    .mo_media_fbdl_item .type,
    .mo_media_fbdl_item .modified {
        display: none;
    }
    
    .mo_media_fbdl_item .mo_media_download_col {
        justify-self: end;
    }
    
    .mo_media_file_thumb {
        width: 36px;
        height: 36px;
    }
    
    .mo_media_file_thumb svg {
        width: 18px;
        height: 18px;
    }
    
    .mo_media_fbdl.grid .mo_media_fbdl_list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    #media_restriction_wrapper_div {
        flex-direction: column;
        gap: 12px;
    }
    
    #media_restriction_wrapper_w30,
    #media_restriction_wrapper_w70 {
        width: 100%;
        padding: 16px;
    }
    
    /* On mobile, always show full sidebar content even when collapsed */
    #media_restriction_wrapper_w30.collapsed {
        width: 100%;
        padding: 16px;
    }
    
    #media_restriction_w30.collapsed .mo_media_folder_sidebar_content {
        display: block;
    }
    
    #media_restriction_wrapper_w30.collapsed .mo_media_folder_sidebar_header h3 {
        display: block;
    }
    
    #media_restriction_wrapper_w30.collapsed hr {
        display: block;
    }
    
    #media_restriction_wrapper_w30.collapsed .mo_media_collapse_menu_text {
        display: inline;
    }
    
    #media_restriction_wrapper_w30.collapsed .mo_media_restriction_collapse_btn {
        width: auto;
        justify-content: flex-start;
    }
    
    #media_restriction_wrapper_w30.collapsed .mo_media_restriction_collapse_btn svg {
        transform: rotate(0deg);
    }
    
    .mo_media_fbdl_header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .mo_media_controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .mo_media_fbdl.grid .mo_media_fbdl_list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .mo_media_fbdl_header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .mo_media_controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .mo_media_folder_icon {
        width: 32px;
        height: 32px;
    }
    
    .mo_media_folder_icon svg {
        width: 16px;
        height: 16px;
    }
    
    .mo_media_fbdl_title h1 {
        font-size: 16px;
    }
    
    .mo_media_fbdl_item {
        padding: 10px;
    }
    
    .mo_media_file_thumb {
        width: 32px;
        height: 32px;
    }
    
    .mo_media_file_thumb svg {
        width: 16px;
        height: 16px;
    }
    
    .mo_media_btn_download {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .mo_media_managment_frontend_upload_media_btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

.mo_media_managment_frontend_upload_media_btn {
    display: inline-block;
    padding: 7px 14px;
    margin-left: 8px;
    background: linear-gradient(180deg, var(--accent) 0%, #03679a 100%);
    border: 0;
    border-radius: 18px;
    font-size: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mo_media_managment_frontend_upload_media_btn:disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.mo_media_managment_frontend_upload_media_btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
    color: white;
}

#mo_media_restriction_media_upload_form {
    width: 100%;
}

#mo_media_restriction_media_upload_div {
    text-align: center;
    border: 1px solid black;
    border-radius: 5px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.mo_media_restriction_close_btn {
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    color: red;
    float: right;
    margin-right: 20px;
    margin-bottom: 10px;
    position: relative;
    right: 2rem;
}

input[type="file"].mo_media_restriction_file_selector_button {
    cursor: pointer;
    margin-right: 16px;
    font-size: 13px;
    padding: 4px 8px;
    max-width: 250px;
}

input[type="file"].mo_media_restriction_file_selector_button::file-selector-button {
    background: linear-gradient(180deg, var(--accent) 0%, #03679a 100%);
    color: white;
    border: 0;
    border-radius: 18px;
    padding: 6px 14px;
    margin-right: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

input[type="file"].mo_media_restriction_file_selector_button::file-selector-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
}

.mo_media_restriction_close_btn:hover {
    opacity: 0.7;
}

#media_restriction_progress_bar {
    width: 51%;
    height: 20px;
    border-radius: 20px;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
    overflow: hidden;
    margin: 0 auto;
}

#media_restriction_progress_bar_label {
    width: 0%;
    height: 100%;
    background-color: #4CAF50;
}

#media_restriction_progress_bar_label_text {
    font-size: 18px;
    font-weight: 500;
}

.mo_media_restriction_upload_div {
    z-index: 9988;
    position: fixed;
    top: 30%;
    left: 40%;
    background-color: #fff;
    height: 38%;
    width: 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
}


/* Folder List Items */
.prevent_file_media_managment_files_file_names {
    cursor: pointer;
    padding: 12px 14px;
    font-size: 14px;
    color: #4b5563;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    font-weight: 500;
    margin-top: 8px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

/* Folder Icon */
.prevent_file_media_managment_files_file_icon {
    margin-right: 10px;
    color: #6b7280;
    font-size: 16px;
    transition: color 0.2s ease;
}

/* Active/Selected Folder Icon */
.prevent_file_media_managment_files_file_icon.active {
    margin-right: 10px;
    color: #0077b6;
}

/* Active/Selected Folder Item */
.prevent_file_media_managment_files_file_names.active {
    font-weight: 600;
    color: #0077b6;
    background: #ffffff;
    border-color: #0077b6;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.15);
}

/* Hover State */
.prevent_file_media_managment_files_file_names:hover {
    color: #0b1220;
    background: #ffffff;
    border-color: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(8, 21, 40, 0.1);
}

.prevent_file_media_managment_files_file_names:hover .prevent_file_media_managment_files_file_icon {
    color: #0077b6;
}

/* Active Hover State */
.prevent_file_media_managment_files_file_names.active:hover {
    color: #0077b6;
    background: #ffffff;
    border-color: #0077b6;
    box-shadow: 0 6px 16px rgba(0, 119, 182, 0.2);
}

.prevent_file_media_managment_files_file_names.active:hover .prevent_file_media_managment_files_file_icon {
    color: #0077b6;
}

/* Hide arrow toggle buttons */
.mo_media_restriction_folder_open_close_btn {
    display: none !important;
}
