/**
 * EOD Media File Browser Styles
 * Modern, clean, and responsive design
 */

/* =============================================
   Variables & Base Styles
   ============================================= */
:root {
    --emfb-primary: #de668b;
    --emfb-primary-dark: #ba4f6f;
    --emfb-secondary: #3d155d;
    --emfb-success: #10b981;
    --emfb-danger: #ef4444;
    --emfb-warning: #f59e0b;
    --emfb-bg: #ffffff;
    --emfb-bg-secondary: #f9fafb;
    --emfb-border: #e5e7eb;
    --emfb-text: #111827;
    --emfb-text-muted: #6b7280;
    --emfb-text-white: #ffffff;
    --emfb-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --emfb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --emfb-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --emfb-radius: 25px;
    --emfb-radius-sm: 8px;
    --emfb-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.emfb-container {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 1.25rem;
    background: var(--emfb-bg);
    border-radius: var(--emfb-radius);
    box-shadow: var(--emfb-shadow-lg);
    position: relative;
}

.emfb-container * {
    box-sizing: border-box;
}

/* =============================================
   Header & Actions
   ============================================= */
.emfb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--emfb-border);
    flex-wrap: wrap;
    gap: 1rem;
}

.emfb-breadcrumb {
    gap: 8px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: var(--emfb-text);
    flex: 1;
    min-width: 200px;
}

.emfb-breadcrumb i {
    color: var(--emfb-primary);
    font-size: 1.75rem;
}

.emfb-breadcrumb-path {
    font-weight: 500;
    gap: 5px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.emfb-breadcrumb-item {
    background-color: #e9e9e9;
    cursor: pointer;
    transition: var(--emfb-transition);
    padding: 0.25rem 0.5rem;
    border-radius: var(--emfb-radius-sm);
}

.emfb-breadcrumb-item:hover {
    background: var(--emfb-primary);
    color: var(--emfb-text-white);
}

.emfb-breadcrumb-separator {
    color: var(--emfb-text-muted);
    font-size: 1rem;
}

.emfb-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.emfb-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--emfb-primary);
    color: white;
    border: none;
    border-radius: var(--emfb-radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 0.938rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--emfb-transition);
    box-shadow: var(--emfb-shadow);
}

.emfb-btn:hover {
    background: var(--emfb-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--emfb-shadow-lg);
}

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

.emfb-refresh-btn {
    background: var(--emfb-bg-secondary);
    color: var(--emfb-text);
    padding: 0.75rem;
}

.emfb-refresh-btn:hover {
    background: var(--emfb-border);
}

.emfb-refresh-btn i {
    transition: var(--emfb-transition);
}

.emfb-refresh-btn:hover i {
    transform: rotate(180deg);
}

/* =============================================
   Drop Zone
   ============================================= */
.emfb-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px dashed var(--emfb-border);
    border-radius: var(--emfb-radius);
    padding: 3rem;
    text-align: center;
    margin-bottom: 0;
    background: var(--emfb-bg-secondary);
    transition: var(--emfb-transition);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
}

.emfb-drop-zone.emfb-drag-over {
    opacity: 1;
    max-height: 300px;
    padding: 3rem;
    margin-bottom: 1rem;
    border-color: var(--emfb-primary);
    background: rgba(99, 102, 241, 0.05);
}

.emfb-drop-zone i {
    font-size: 3rem;
    color: var(--emfb-primary);
    margin-bottom: 1rem;
}

.emfb-drop-zone p {
    font-size: 1.125rem;
    color: var(--emfb-text);
    margin: 0;
    font-weight: 500;
}

/* =============================================
   Upload Progress
   ============================================= */
.emfb-upload-progress {
    background: var(--emfb-bg-secondary);
    border-radius: var(--emfb-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: emfbSlideDown 0.3s ease-out;
}

.emfb-upload-item {
    margin-bottom: 0.75rem;
}

.emfb-upload-item:last-child {
    margin-bottom: 0;
}

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

.emfb-upload-filename {
    font-weight: 500;
    color: var(--emfb-text);
    font-size: 0.938rem;
}

.emfb-upload-percentage {
    font-size: 0.875rem;
    color: var(--emfb-text-muted);
    font-weight: 600;
}

.emfb-progress-bar {
    height: 8px;
    background: var(--emfb-border);
    border-radius: 999px;
    overflow: hidden;
}

.emfb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--emfb-primary), var(--emfb-secondary));
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0;
}

/* =============================================
   Content Area
   ============================================= */
.emfb-content {
    height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding-right: 0.5rem;
}

/* Webkit scrollbar styling */
.emfb-content::-webkit-scrollbar {
    width: 8px;
}

.emfb-content::-webkit-scrollbar-track {
    background: var(--emfb-bg-secondary);
    border-radius: 4px;
}

.emfb-content::-webkit-scrollbar-thumb {
    background: var(--emfb-border);
    border-radius: 4px;
    transition: var(--emfb-transition);
}

.emfb-content::-webkit-scrollbar-thumb:hover {
    background: var(--emfb-text-muted);
}

/* =============================================
   Loading Skeleton
   ============================================= */
.emfb-loading {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.emfb-skeleton-item {
    height: 60px;
    background: linear-gradient(
        90deg,
        var(--emfb-bg-secondary) 0%,
        #e5e7eb 50%,
        var(--emfb-bg-secondary) 100%
    );
    background-size: 200% 100%;
    border-radius: var(--emfb-radius-sm);
    animation: emfbSkeleton 1.5s ease-in-out infinite;
}

@keyframes emfbSkeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* =============================================
   Empty State
   ============================================= */
.emfb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.emfb-empty i {
    font-size: 4rem;
    color: var(--emfb-text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.emfb-empty p {
    font-size: 1.25rem;
    color: var(--emfb-text);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.emfb-empty small {
    font-size: 0.938rem;
    color: var(--emfb-text-muted);
}

/* =============================================
   File & Folder List
   ============================================= */
.emfb-list {
    display: grid;
    gap: 0.4rem;
    animation: emfbFadeIn 0.3s ease-out;
}

.emfb-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--emfb-bg-secondary);
    border: 2px solid var(--emfb-border);
    border-radius: var(--emfb-radius-sm);
    transition: var(--emfb-transition);
    cursor: pointer;
}

.emfb-item:hover {
    background: white;
    border-color: var(--emfb-primary);
    transform: scale(0.99);
    box-shadow: var(--emfb-shadow);
}

.emfb-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--emfb-radius-sm);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.emfb-item-icon.emfb-folder {
    background: rgba(99, 102, 241, 0.1);
    color: var(--emfb-primary);
}

.emfb-item-icon.emfb-audio {
    background: rgba(139, 92, 246, 0.1);
    color: var(--emfb-secondary);
}

.emfb-item-icon.emfb-image {
    background: rgba(16, 185, 129, 0.1);
    color: var(--emfb-success);
}

.emfb-item-icon.emfb-video {
    background: rgba(239, 68, 68, 0.1);
    color: var(--emfb-danger);
}

.emfb-item-icon.emfb-document {
    background: rgba(245, 158, 11, 0.1);
    color: var(--emfb-warning);
}

.emfb-item-icon.emfb-file {
    background: rgba(107, 114, 128, 0.1);
    color: var(--emfb-text-muted);
}

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

.emfb-item-name {
    font-weight: 500;
    color: var(--emfb-text);
    font-size: 0.938rem;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.emfb-item-meta {
    font-size: 0.813rem;
    color: var(--emfb-text-muted);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.emfb-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--emfb-transition);
}

.emfb-item:hover .emfb-item-actions {
    opacity: 1;
}

.emfb-item-action {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--emfb-radius-sm);
    background: white;
    border: 1px solid var(--emfb-border);
    color: var(--emfb-text-muted);
    cursor: pointer;
    transition: var(--emfb-transition);
}

.emfb-item-action:hover {
    background: var(--emfb-primary);
    color: white;
    border-color: var(--emfb-primary);
    transform: scale(1.1);
}

/* =============================================
   Audio Player - MediaElement.js Custom Styling
   ============================================= */
.emfb-audio-player {
    position: relative;
    width: 100%;
    background: var(--emfb-bg);
    border: 1px solid var(--emfb-border);
    border-radius: var(--emfb-radius);
    box-shadow: var(--emfb-shadow);
    margin-top: 1rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.emfb-audio-player.emfb-player-open {
    max-height: 200px;
    opacity: 1;
    transform: translateY(0);
}

.emfb-player-wrapper {
    padding: 1.25rem;
}

.emfb-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 5px;
    margin-bottom: 1.5rem;
}

.emfb-player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.emfb-player-info i {
    color: var(--emfb-primary);
    font-size: 1.25rem;
    flex-shrink: 0;
    animation: emfbPulse 2s ease-in-out infinite;
}

@keyframes emfbPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.emfb-player-title {
    font-weight: 600;
    color: var(--emfb-text);
    font-size: 0.938rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emfb-player-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--emfb-bg-secondary);
    border: none;
    border-radius: 50%;
    color: var(--emfb-text-muted);
    cursor: pointer;
    transition: var(--emfb-transition);
    flex-shrink: 0;
}

.emfb-player-close:hover {
    background: var(--emfb-danger);
    color: white;
    transform: rotate(90deg) scale(1.1);
}

/* Player main section */
.emfb-player-main {
    margin-bottom: 0.5rem;
}

/* Custom MediaElement.js styling */
.emfb-audio-player .mejs-container {
    background: transparent !important;
    font-family: 'Outfit', sans-serif !important;
}

.emfb-audio-player .mejs-controls {
    background: transparent !important;
    height: 60px !important;
    padding: 0 !important;
}

/* Big play button with gradient */
.emfb-audio-player .mejs-playpause-button {
    width: 56px !important;
    height: 56px !important;
    margin-right: 0.25rem !important;
    background: linear-gradient(135deg, var(--emfb-primary) 0%, var(--emfb-secondary) 100%) !important;
    border-radius: 50% !important;
    position: relative !important;
    transition: all 0.3s ease !important;
}

.emfb-audio-player .mejs-playpause-button:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 4px 12px rgba(222, 102, 139, 0.3) !important;
}

.emfb-audio-player .mejs-playpause-button button {
    width: 56px !important;
    height: 56px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900 !important;
    color: white !important;
    font-size: 1.25rem !important;
}

/* Play icon */
.emfb-audio-player .mejs-playpause-button.mejs-play button:before {
    content: "\f04b" !important;
    color: white !important;
    margin-left: 3px !important;
}

/* Pause icon */
.emfb-audio-player .mejs-playpause-button.mejs-pause button:before {
    content: "\f04c" !important;
    color: white !important;
}

/* Time display */
.emfb-audio-player .mejs-time {
    color: var(--emfb-text-muted) !important;
    font-size: 0.813rem !important;
    font-weight: 500 !important;
    padding: 0 0.5rem !important;
    height: 60px !important;
    line-height: 60px !important;
}

/* Progress bar container */
.emfb-audio-player .mejs-time-rail {
    padding-top: 0 !important;
    height: 60px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.emfb-audio-player .mejs-time-total {
    background: var(--emfb-bg-secondary) !important;
    height: 16px !important;
    border-radius: 8px !important;
    margin: 0 !important;
    overflow: hidden !important;
    position: relative !important;
    cursor: pointer !important;
}

/* Gradient progress bar */
.emfb-audio-player .mejs-time-current,
.emfb-audio-player .mejs-time-loaded {
    background: linear-gradient(90deg, var(--emfb-primary) 0%, var(--emfb-secondary) 100%) !important;
    height: 16px !important;
    border-radius: 8px !important;
    transition: all 0.15s ease-out !important;
}

.emfb-audio-player .mejs-time-loaded {
    opacity: 0.3 !important;
}

/* Hide progress handle completely */
.emfb-audio-player .mejs-time-handle,
.emfb-audio-player .mejs-time-handle-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Hide hover layer/overlay on progress bar */
.emfb-audio-player .mejs-time-hovered,
.emfb-audio-player .mejs-time-float,
.emfb-audio-player .mejs-time-float-current,
.emfb-audio-player .mejs-time-float-corner,
.emfb-audio-player span.mejs-time-hovered {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Hide volume and other controls */
.emfb-audio-player .mejs-volume-button,
.emfb-audio-player .mejs-horizontal-volume-slider {
    display: none !important;
}

/* Download button */
.emfb-player-controls {
    display: flex;
    gap: 0.5rem;
}

.emfb-player-download {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--emfb-bg-secondary);
    color: var(--emfb-text);
    border: 1px solid var(--emfb-border);
    border-radius: var(--emfb-radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--emfb-transition);
}

.emfb-player-download:hover {
    background: var(--emfb-primary);
    color: white;
    border-color: var(--emfb-primary);
    transform: translateY(-2px);
    box-shadow: var(--emfb-shadow);
}

/* =============================================
   Error States
   ============================================= */
.emfb-error {
    padding: 1rem 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--emfb-danger);
    border-radius: var(--emfb-radius-sm);
    color: var(--emfb-danger);
    font-weight: 500;
    text-align: center;
}

/* =============================================
   Animations
   ============================================= */
@keyframes emfbFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes emfbSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* =============================================
   Responsive Design
   ============================================= */
@media (max-width: 768px) {
    .emfb-container {
        padding: 1rem;
    }
    
    .emfb-content {
        height: 350px;
    }
    
    .emfb-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .emfb-breadcrumb {
        min-width: auto;
        justify-content: center;
        text-align: center;
        font-size: 1.063rem;
        padding: 0.5rem;
    }
    
    .emfb-breadcrumb i {
        font-size: 1.375rem;
    }
    
    .emfb-breadcrumb-item {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .emfb-breadcrumb-separator {
        font-size: 1rem;
        margin: 0 0.25rem;
    }
    
    .emfb-actions {
        justify-content: center;
        gap: 1rem;
    }
    
    .emfb-btn {
        flex: 1;
        max-width: 200px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 50px;
    }
    
    .emfb-btn span {
        display: inline;
    }
    
    .emfb-refresh-btn {
        padding: 1rem 1.5rem;
        min-width: 120px;
    }
    
    .emfb-refresh-btn::after {
        content: " Reload";
        margin-left: 0.5rem;
    }
    
    .emfb-item {
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .emfb-item-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .emfb-item-info {
        min-width: 0;
        flex: 1;
    }
    
    .emfb-item-name {
        font-size: 0.875rem;
    }
    
    .emfb-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        font-size: 0.75rem;
    }
    
    .emfb-item-actions {
        opacity: 1;
        flex-shrink: 0;
    }
    
    .emfb-audio-player.emfb-player-open {
        max-height: 200px;
    }
    
    .emfb-player-wrapper {
        padding: 1rem;
    }
    
    .emfb-player-title {
        font-size: 0.875rem;
    }
    
    .emfb-audio-player .mejs-playpause-button {
        width: 48px !important;
        height: 48px !important;
    }
    
    .emfb-audio-player .mejs-playpause-button button {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.125rem !important;
    }
    
    .emfb-audio-player .mejs-playpause-button.mejs-play button:before {
        margin-left: 2px !important;
    }
    
    .emfb-audio-player .mejs-controls {
        height: 56px !important;
    }
    
    .emfb-audio-player .mejs-time-rail {
        height: 56px !important;
    }
    
    .emfb-audio-player .mejs-time {
        height: 56px !important;
        line-height: 56px !important;
        font-size: 0.75rem !important;
    }
    
    /* Bigger progress bar for touch on tablet */
    .emfb-audio-player .mejs-time-total {
        height: 18px !important;
        border-radius: 9px !important;
    }
    
    .emfb-audio-player .mejs-time-current,
    .emfb-audio-player .mejs-time-loaded {
        height: 18px !important;
        border-radius: 9px !important;
    }
    
    .emfb-drop-zone.emfb-drag-over {
        padding: 2rem 1rem;
    }
    
    .emfb-drop-zone i {
        font-size: 2rem;
    }
    
    .emfb-drop-zone p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .emfb-container {
        border-radius: var(--emfb-radius-sm);
        padding: 0.75rem;
    }
    
    .emfb-content {
        height: 400px;
    }
    
    .emfb-breadcrumb {
        font-size: 0.938rem;
    }
    
    .emfb-breadcrumb-path {
        font-size: 0.938rem;
    }
    
    .emfb-breadcrumb-item {
        font-size: 0.938rem;
        padding: 0.5rem 0.625rem;
    }
    
    .emfb-btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.938rem;
        min-height: 48px;
    }
    
    .emfb-refresh-btn {
        padding: 0.875rem 1.25rem;
        min-width: 110px;
    }
    
    .emfb-actions {
        flex-wrap: wrap;
    }
    
    .emfb-audio-player.emfb-player-open {
        max-height: 200px;
    }
    
    .emfb-player-wrapper {
        padding: 0.875rem;
    }
    
    .emfb-player-info i {
        font-size: 1rem;
    }
    
    .emfb-player-title {
        font-size: 0.813rem;
    }
    
    .emfb-player-close {
        width: 28px;
        height: 28px;
    }
    
    .emfb-audio-player .mejs-playpause-button {
        width: 44px !important;
        height: 44px !important;
    }
    
    .emfb-audio-player .mejs-playpause-button button {
        width: 44px !important;
        height: 44px !important;
        font-size: 1rem !important;
    }
    
    .emfb-audio-player .mejs-playpause-button.mejs-play button:before {
        margin-left: 2px !important;
    }
    
    .emfb-audio-player .mejs-controls {
        height: 52px !important;
    }
    
    .emfb-audio-player .mejs-time-rail {
        height: 52px !important;
    }
    
    .emfb-audio-player .mejs-time {
        height: 52px !important;
        line-height: 52px !important;
        font-size: 0.75rem !important;
    }
    
    /* Extra big progress bar for touch on mobile */
    .emfb-audio-player .mejs-time-total {
        height: 20px !important;
        border-radius: 10px !important;
    }
    
    .emfb-audio-player .mejs-time-current,
    .emfb-audio-player .mejs-time-loaded {
        height: 20px !important;
        border-radius: 10px !important;
    }
    
    .emfb-player-download {
        padding: 0.5rem 0.75rem;
        font-size: 0.813rem;
    }
}

/* =============================================
   Print Styles
   ============================================= */
@media print {
    .emfb-actions,
    .emfb-drop-zone,
    .emfb-audio-player,
    .emfb-item-actions {
        display: none !important;
    }
}

