.dmg-gallery-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.dmg-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 14px;
}

.dmg-view-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.dmg-view-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.dmg-view-btn svg { width: 16px; height: 16px; }
.dmg-view-btn:hover { border-color: #1a73e8; color: #1a73e8; }
.dmg-view-btn.is-active { background: #1a73e8; border-color: #1a73e8; color: #fff; }

.dmg-search {
    flex: 1;
    max-width: 280px;
    margin-left: auto;
    padding: 7px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

.dmg-search:focus { border-color: #1a73e8; }

.dmg-grid-view .dmg-media-item .dmg-item-name,
.dmg-grid-view .dmg-media-item .dmg-item-size,
.dmg-grid-view .dmg-media-item .dmg-item-actions {
    display: none;
}

.dmg-grid-view .dmg-media-item {
    background: none;
    box-shadow: none;
    border-radius: 8px;
    overflow: hidden;
}

.dmg-grid-view .dmg-media-item:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.dmg-list-view {
    display: flex !important;
    flex-direction: column;
    gap: 0;
}

.dmg-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 6px;
}

.dmg-list-row:hover { background: #f8f9fa; }

.dmg-list-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.dmg-list-icon svg { width: 20px; height: 20px; }

.dmg-list-icon-folder { background: #e8f0fe; color: #1a73e8; }
.dmg-list-icon-pdf    { background: #fce8e6; color: #d93025; }
.dmg-list-icon-video  { background: #e6f4ea; color: #188038; }
.dmg-list-icon-image  { background: #fef7e0; color: #f29900; }

.dmg-list-icon-thumb { overflow: hidden; }
.dmg-list-icon-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }

.dmg-list-name {
    flex: 1;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dmg-list-folder-row .dmg-list-name { font-weight: 500; }

.dmg-list-meta {
    font-size: 12px;
    color: #999;
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

.dmg-list-actions { display: flex; gap: 6px; flex-shrink: 0; }

.dmg-list-btn-action {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.dmg-list-btn-preview { background: #f1f3f4; color: #333; }
.dmg-list-btn-preview:hover { background: #e0e0e0; }
.dmg-list-btn-download { background: #1a73e8; color: #fff; }
.dmg-list-btn-download:hover { background: #1557b0; }

.dmg-breadcrumb {
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.dmg-crumb {
    font-size: 14px;
    color: #333;
}

.dmg-crumb-link {
    color: #0073aa;
    cursor: pointer;
    transition: color 0.2s;
}

.dmg-crumb-link:hover {
    color: #005177;
    text-decoration: underline;
}

.dmg-crumb-current {
    font-weight: 600;
    color: #333;
}

.dmg-crumb-separator {
    color: #999;
}

.dmg-back-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 10px;
    transition: background 0.2s;
}

.dmg-back-btn:hover {
    background: #005177;
}

.dmg-loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.dmg-error,
.dmg-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
}

.dmg-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

.dmg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--dmg-columns, 4), 1fr);
    gap: 20px;
    margin-top: 20px;
}

.dmg-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.dmg-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dmg-folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.dmg-folder-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
}

.dmg-folder-icon svg {
    width: 100%;
    height: 100%;
    stroke: white;
}

.dmg-folder .dmg-item-name {
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
}

.dmg-thumbnail {
    width: 100%;
    aspect-ratio: 1;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.dmg-thumbnail img,
.dmg-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dmg-no-thumbnail {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.dmg-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.dmg-video-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
    margin-left: 3px;
}

.dmg-pdf-placeholder {
    background: linear-gradient(135deg, #9e9e9e 0%, #616161 100%);
}

.dmg-pdf-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.dmg-pdf-icon svg {
    width: 6px;
    height: 6px;
    stroke: white;
}

.dmg-lightbox-pdf-container {
    background: #f5f5f5;
    min-height: 75vh;
    padding: 0;
    align-items: stretch;
}

.dmg-pdf-embed {
    width: 100%;
    height: 75vh;
    border: none;
    display: block;
}

.dmg-gallery-footer {
    text-align: right;
    font-size: 11px;
    color: #ccc;
    padding: 12px 4px 0;
    margin-top: 8px;
    border-top: 1px solid #f5f5f5;
}

.dmg-item-name {
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dmg-item-size {
    padding: 0 12px 8px;
    font-size: 12px;
    color: #999;
}

.dmg-item-actions {
    display: flex;
    gap: 0;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.dmg-preview-btn,
.dmg-download-btn {
    flex: 1;
    display: block;
    width: 100%;
    padding: 10px;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.dmg-preview-btn {
    background: #546e7a;
    border-radius: 0 0 0 8px;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.dmg-preview-btn:hover {
    background: #37474f;
}

.dmg-download-btn {
    background: #1a73e8;
    border-radius: 0 0 8px 0;
}

.dmg-download-btn:hover {
    background: #1557b0;
}

.dmg-download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.dmg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dmg-lightbox-content {
    background: white;
    border-radius: 8px;
    max-width: 1000px;
    max-height: 90vh;
    width: 100%;
    overflow: auto;
    position: relative;
}

.dmg-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.dmg-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.dmg-lightbox-media {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #000;
}

.dmg-lightbox-media img,
.dmg-lightbox-media video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 4px;
}

.dmg-lightbox-loading {
    color: white;
    font-size: 16px;
}

.dmg-lightbox-info {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.dmg-lightbox-info h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #333;
}

.dmg-lightbox-info p {
    margin: 0 0 15px;
    color: #666;
    font-size: 14px;
}

.dmg-lightbox-download {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.dmg-lightbox-download:hover {
    background: #005177;
}

@media (max-width: 1200px) {
    .dmg-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .dmg-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dmg-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .dmg-gallery-container {
        padding: 15px;
    }
    
    .dmg-thumbnail {
        height: 150px;
    }
    
    .dmg-breadcrumb {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .dmg-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .dmg-thumbnail {
        height: 200px;
    }
    
    .dmg-lightbox-content {
        max-height: 95vh;
    }
    
    .dmg-lightbox-media img,
    .dmg-lightbox-media video {
        max-height: 50vh;
    }
}
