/* Module-specific styles - Legacy/Forum Look */
.files-module {
    box-sizing: border-box;

    /* Colors derived from style.css */
    --primary: #39728a;       /* Link color */
    --primary-dark: #2c5f75;  /* Hover color */
    --secondary: #5790a1;     /* Content bg / Accent */
    --success: #4CAF50;
    --danger: #cc1559;        /* Global error color */
    --warning: #FF9800;
    
    --bg-light: #f5f5f5;      /* Global subhead bg */
    --bg-white: #ffffff;
    
    --border: #e8e8ea;        /* Global border */
    --border-light: #ffffff;  /* Global light border (top) */
    
    --text-main: #5e5f5e;     /* Global body text */
    --text-muted: #888888;
}

/* Media Container */
.f-media-container {
    width: 100%;
    display: flex;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
}

.f-media-container video, 
.f-media-container audio {
    max-width: 100% !important;
    border-radius: 8px;
    margin: 0 auto;
}

/* Plyr Styles */
.f-media-container .plyr {
    width: 100% !important;
    border-radius: 8px;
    margin: 0 auto;
}

/* Limit height only when NOT in fullscreen */
.f-media-container .plyr:not(.plyr--fullscreen-active) {
    max-height: 600px;
}



.f-media-container img {
    max-width: 100%;
    max-height: 600px;
    border-radius: 8px;
    width: auto;
    object-fit: contain;
}

/* Utilities - Tighter Spacing */
.f-flex { display: flex; align-items: center; }
.f-gap-1 { gap: 4px; }
.f-gap-2 { gap: 8px; }
.f-gap-3 { gap: 12px; }
.f-mb-0 { margin-bottom: 0 !important; }
.f-mt-0 { margin-top: 0 !important; }
.f-mt-1 { margin-top: 4px; }
.f-mt-2 { margin-top: 5px; }
.f-mt-3 { margin-top: 10px; }
.f-mt-4 { margin-top: 15px; }
.f-mb-2 { margin-bottom: 5px; }
.f-mb-3 { margin-bottom: 10px; }
.f-w-100 { width: 100%; }
.f-text-center { text-align: center; }
.f-text-right { text-align: right; }
.f-wrap { flex-wrap: wrap; }
.f-flex-wrap { flex-wrap: wrap; }
.f-flex-center { justify-content: center; }
.f-justify-between { justify-content: space-between; }
.f-justify-end { justify-content: flex-end; }
.f-align-center { align-items: center; }
.fw-bold { font-weight: bold; }
.text-muted { color: var(--text-muted); }

/* Section Title - Matches .apicms_titles */
.f-section-title {
    color: var(--primary);
    padding: 7px;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    display: block;
    font-weight: bold;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.f-section-title i {
    font-size: 20px;
    vertical-align: middle;
    color: var(--primary);
}

/* Description Box */
.f-desc {
    padding: 7px;
    background: #fdfdfd;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 0;
}

/* Folder List & File List Items - Mimic .apicms_subhead exactly */
.f-list-container, .file-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.f-folder-list-item, .f-card {
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    padding: 7px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    color: var(--primary);
    border-radius: 0;
    margin-bottom: 0;
    position: relative;
    transition: background-color 0.2s;
}

.f-folder-list-item:hover, .f-card:hover {
    background-color: #f1f1f1;
    color: var(--primary-dark);
}

/* Wrapper for folder item + actions */
.f-folder-item-wrapper {
    display: flex;
    align-items: stretch;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

/* Reset inner item styles when in wrapper */
.f-folder-item-wrapper .f-folder-list-item {
    border: none;
    background: transparent;
    flex-grow: 1;
    margin-bottom: 0;
}

.f-folder-delete {
    padding: 0 12px;
    color: var(--danger);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0.7;
    border-left: 1px solid var(--border);
}
.f-folder-delete:hover {
    opacity: 1;
    background-color: #f1f1f1;
}

.f-file-edit {
    color: var(--warning);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.f-file-edit:hover {
    background-color: rgba(255, 193, 7, 0.1);
}

.f-file-delete {
    color: var(--danger);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.f-file-delete:hover {
    background-color: rgba(220, 53, 69, 0.1); /* Light red bg on hover */
}

/* Icon - Larger 50x50 */
.f-folder-list-icon, .f-icon-box {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: inherit;
    font-size: 32px;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}

.f-icon-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Content Area */
.f-folder-list-content, .f-info {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Titles */
.f-folder-list-name, .f-title {
    font-weight: bold;
    font-size: 13px;
    color: inherit;
    margin: 0;
    white-space: normal;
    line-height: 1.3;
    text-decoration: none !important;
}

.f-title:hover {
    text-decoration: underline !important;
}

/* Meta info */
.f-folder-list-count, .f-meta {
    font-size: 11px;
    color: var(--text-main);
    margin-top: 2px;
}

.f-meta span {
    display: inline-block;
    margin-right: 5px;
}
.f-meta .f-nav-sep { display: none; }

/* Arrow / Actions */
.f-folder-list-arrow {
    display: none;
}

/* Actions in list items */
.f-folder-list-item .f-actions, .f-card .f-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Buttons inside lists should be small icons */
.f-folder-list-item .f-actions .f-btn, .f-card .f-actions .f-btn {
    padding: 2px;
    background: transparent;
    border: none;
    color: var(--primary);
    width: auto;
    height: auto;
}
.f-folder-list-item .f-actions .f-btn:hover, .f-card .f-actions .f-btn:hover { color: var(--danger); }

/* Block Container for Forms/Content (No Flex) */
.f-block {
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    padding: 7px;
    display: block;
    margin-bottom: 0;
}

/* Navbar */
.f-nav {
    padding: 7px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-weight: bold;
    color: var(--primary);
    font-size: 13px;
}

/* Global icon style in nav */
.f-nav i {
    font-size: 20px;
    vertical-align: middle;
    color: var(--primary);
}

.f-nav .f-nav-sep i {
    color: var(--text-muted); /* Separators should be less prominent */
    font-size: 18px;
}

.f-nav-item {
    color: var(--primary);
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 4px;
}
.f-nav-item:hover { text-decoration: underline !important; }
.f-nav-item.f-active { color: var(--text-main); pointer-events: none; }
.f-nav-sep { 
    color: var(--text-main); 
    font-weight: normal; 
    display: flex;
    align-items: center;
}


/* Alerts */
.f-alert {
    padding: 7px;
    margin-bottom: 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: block;
    text-align: center;
    font-weight: bold;
}

.f-alert-danger {
    background-color: var(--danger);
    color: #ffffff;
    border-top: 1px #ffffff solid;
    border-bottom: 1px #e8e8ea solid;
}
.f-alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

/* Forms */
.f-form-group { margin-bottom: 0; padding: 7px; background: var(--bg-light); border-bottom: 1px solid var(--border); }
.f-form-label { display: block; margin-bottom: 4px; font-weight: bold; color: var(--text-main); font-size: 13px; }

.f-form-control, .f-input {
    width: 100%;
    padding: 4px 6px;
    font-size: 13px;
    border-radius: 5px;
    background: #fff url(/design/styles/default/style_images/input.gif) repeat-x top;
    border: 1px solid #326d85;
    color: var(--text-main);
    box-sizing: border-box;
    font-family: inherit;
}
.f-form-control:focus { outline: none; border-color: var(--primary); }

/* Buttons - Modern & Beautiful */
.f-btn {
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.2;
    background: var(--secondary);
    color: #fff !important;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    letter-spacing: 0.2px;
}

.f-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    filter: brightness(105%);
}

.f-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.f-btn i { font-size: 20px; }

.f-btn-sm { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* Calmer Colors */
.f-btn-primary { 
    background: #557999 !important; /* Muted Blue */
    border-color: transparent !important;
    color: #fff !important;
}

.f-btn-danger { 
    background: #c75c5c !important; /* Muted Red */
    border-color: transparent !important;
    color: #fff !important;
}

.f-btn-success { 
    background: #5aa167 !important; /* Muted Green */
    border-color: transparent !important;
    color: #fff !important;
}

.f-btn-warning { 
    background: #d69e45 !important; /* Muted Orange */
    border-color: transparent !important;
    color: #fff !important;
}

.f-btn-outline { 
    background: transparent !important; 
    border: 1px solid var(--border) !important; 
    color: var(--primary) !important; 
    box-shadow: none !important;
}
.f-btn-outline:hover { 
    background: #fff !important; 
    border-color: var(--primary) !important;
    color: var(--primary-dark) !important;
}

/* Empty State */
.f-empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-main);
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    font-weight: bold;
}
.f-empty-icon { display: none; }
.f-empty-text { font-size: 13px; }


/* File View Specifics */
.f-view-header {
    padding: 7px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.f-view-preview {
    padding: 10px;
    text-align: center;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.f-info-row {
    padding: 7px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 0;
}
.f-info-label { color: var(--text-main); }
.f-info-label i {
    color: var(--primary);
    font-size: 20px;
    vertical-align: middle;
    margin-right: 4px;
}
.f-info-value { font-weight: bold; color: var(--text-main); }

/* Comments - Forum Style */
.f-forum-post {
    display: flex;
    padding: 0;
    overflow: hidden;
    gap: 0;
    margin-bottom: 0;
}

.f-forum-post + .f-forum-post {
    margin-top: -1px;
}

.f-post-sidebar {
    width: 80px;
    background: #fcfcfc;
    border-right: 1px solid var(--border-light);
    padding: 15px 5px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.f-avatar i {
    font-size: 32px;
    color: #b0bec5;
}

.f-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.f-post-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Fix flex overflow */
}

.f-post-header {
    background: #f8f9fa;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: flex-end;
}

.f-comment-body {
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-main);
}

.f-comment-author {
    font-weight: 600;
    color: var(--primary);
    font-size: 12px;
    word-break: break-word;
    line-height: 1.2;
}

/* Upload Zone */
.f-upload-zone {
    border: 1px dashed var(--border);
    background: #fff;
    padding: 20px;
    text-align: center;
    margin: 10px 0;
}

/* Upload Component Logic Styles */
.f-upload-zone.dragover {
    background: #e3f2fd;
    border-color: var(--primary);
}

.f-upload-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.f-preview-item {
    box-sizing: border-box;
    height: auto;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    gap: 10px;
}

.f-preview-thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.f-preview-thumb img, .f-preview-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.f-preview-info {
    font-size: 12px;
    text-align: center;
    word-break: break-all;
    width: 100%;
    color: var(--text-main);
}

.f-preview-info.clickable {
    cursor: pointer;
}

/* Custom Radio Button for Cover Selection */
.f-preview-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    user-select: none;
}

.f-preview-label:hover {
    background-color: #f0f0f0;
}

.f-preview-radio {
    display: none; /* Hide native radio */
}

.f-radio-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

/* Checked state logic: Input is sibling to indicator */
.f-preview-radio:checked + .f-radio-indicator {
    border-color: var(--primary);
    background-color: var(--primary);
}

.f-preview-radio:checked + .f-radio-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background-color: #fff;
    border-radius: 50%;
}

.f-preview-radio:checked ~ .f-label-text {
    color: var(--primary);
    font-weight: bold;
}

/* Video Placeholder Icon */
.f-video-icon-placeholder {
    font-size: 32px;
    color: #5C6BC0;
}

/* Hidden Video for Thumbnail Generation */
.f-hidden-video {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 320px;
    height: 240px;
}

.f-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 10;
}

.f-preview-remove:hover {
    background: var(--danger);
    color: #fff;
}

.f-progress-container {
    display: none;
    margin-top: 15px;
}

.f-progress {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

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

.f-progress-text {
    text-align: center;
    font-size: 12px;
    margin-top: 5px;
    color: var(--text-muted);
}

/* Comment Action Buttons */
.f-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 5px;
    color: var(--text-muted);
    transition: color 0.2s;
    font-size: 16px;
    text-decoration: none !important;
}

.f-action-btn:hover {
    color: var(--primary);
}

.f-action-btn.f-text-primary { color: var(--primary); }
.f-action-btn.f-text-primary:hover { color: var(--primary-dark); }

.f-action-btn.f-text-danger { color: var(--danger); }
.f-action-btn.f-text-danger:hover { color: #b71c1c; }

/* Custom Modal */
.f-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.f-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 320px;
    overflow: hidden;
    animation: f-modal-in 0.2s ease-out;
}

@keyframes f-modal-in {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.f-modal-header {
    padding: 15px;
    font-weight: bold;
    font-size: 16px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.f-modal-body {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.f-modal-footer {
    display: flex;
    border-top: 1px solid var(--border);
}

.f-modal-btn {
    flex: 1;
    padding: 12px;
    border: none !important;
    background: #fff !important;
    background-image: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    outline: none;
    text-shadow: none !important;
}

.f-modal-btn:first-child {
    border-right: 1px solid var(--border) !important;
    color: var(--text-main) !important;
    border-bottom-left-radius: 8px !important;
}

.f-modal-btn:last-child {
    color: var(--danger) !important;
    font-weight: bold;
    border-bottom-right-radius: 8px !important;
}

.f-modal-btn:hover {
    background-color: #f5f5f5 !important;
    background-image: none !important;
}

.f-modal-btn:last-child:hover {
    background-color: #fff0f0 !important; /* Light red tint */
}
/* Toast Notification */
.f-toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px 24px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s, top 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.f-toast.show {
    visibility: visible;
    opacity: 1;
    top: 40px;
}
.f-toast.success { background-color: #4CAF50; }
.f-toast.error { background-color: #d32f2f; }

