/* Modern Folder UI Styles */
.folder-card {
    display: block;
    width: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.folder-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.folder-card-inner {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.folder-card:hover .folder-card-inner {
    border-color: #4CAF50;
}

.folder-cover {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.folder-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.folder-card:hover .folder-cover img {
    transform: scale(1.05);
}

.folder-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    padding: 15px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.folder-card:hover .folder-overlay {
    opacity: 1;
}

.folder-count {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.folder-info {
    padding: 10px 12px;
    background: #fff;
}

.folder-name {
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-name a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.folder-name a:hover {
    color: #4CAF50;
}

.folder-desc {
    margin: 0;
    font-size: 11px;
    color: #888;
    line-height: 1.3;
    display: none; /* hide description to save space */
}

.folder-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.folder-card:hover .folder-actions {
    opacity: 1;
}

.folder-action {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    color: #666;
}

.folder-action svg {
    width: 14px;
    height: 14px;
}

.folder-action:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.folder-action.edit:hover {
    background: #2196F3;
    color: #fff;
}

.folder-action.del:hover {
    background: #f44336;
    color: #fff;
}

/* Grid layout */
#folderview {
    margin: 40px 0 20px 0 !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    clear: both !important;
    float: none !important;
    position: relative !important;
}

/* Ensure zak1 doesn't affect folderview */
.zak1 {
    clear: both !important;
    float: none !important;
    display: block !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    position: relative !important;
}

/* Ensure folderview is positioned after zak1 */
.zak1 + #folderview,
.zak1 ~ #folderview {
    clear: both !important;
    float: none !important;
    display: grid !important;
    position: relative !important;
    margin-top: 40px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Override old float-based styles */
.folder-wrapper {
    float: none !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
}

/* Clearfix deprecated - use flexbox/grid instead */
.clearfix {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

/* Button bar */
.buttonbar {
    margin-top: 20px;
    padding: 20px 0;
    border-top: 2px solid #e0e0e0;
}

#add-folder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#add-folder:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

#add-folder:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    #folderview {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    #folderview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    #folderview {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Default folder styling */
.folder-card[data-folder-id="0"] .folder-cover {
    background: linear-gradient(135deg, #3a3a3a 0%, #1a1a1a 100%);
}

.folder-card[data-folder-id="0"] .folder-name::before {
    content: "📁 ";
}

