/* Floating Add Files Button */
.floating-add-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    font-weight: 300;
}

.floating-add-btn:hover {
    transform: scale(1.05);
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.floating-add-btn:active {
    transform: scale(0.98);
}

.floating-add-btn .btn-icon {
    transition: transform 0.3s ease;
}

.floating-add-btn.active .btn-icon {
    transform: rotate(45deg);
}

/* Upload Form Styles */
#upload-form-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Upload Progress Bar */
#upload-progress {
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.upload-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.close-upload-form {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-upload-form:hover {
    color: var(--text-primary);
}

/* Gallery Header */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
    flex-wrap: wrap;
    gap: 12px;
}

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

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-nav a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-nav a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

.shared-indicator {
    color: var(--accent-primary);
    font-size: 0.9em;
    font-style: italic;
    margin-left: 8px;
}

.item-count {
    color: var(--text-secondary);
    font-weight: normal;
    font-size: 0.9em;
}

/* Gallery Grid Layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.gallery-item {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-secondary);
}

/* Folder Items */
.folder-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-height: 200px;
    background: var(--bg-tertiary);
}

.folder-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.folder-icon {
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.folder-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.folder-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.btn-action {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-action:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.shared-folder-item {
    border-color: var(--accent-primary);
    background: rgba(66, 153, 225, 0.05);
}

.shared-badge {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: normal;
}

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 4px;
    gap: 4px;
}

.view-mode-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.view-mode-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.view-mode-btn.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.gallery-item img:hover {
    opacity: 0.9;
}

.gallery-item-description {
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    line-height: 1.5;
}

.gallery-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
}

.gallery-item-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-delete {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-delete:hover {
    background: var(--danger);
    color: var(--text-primary);
}

/* Upload Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px dashed var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input[type="file"]:hover {
    border-color: var(--accent-primary);
}

.form-group input[type="file"]::file-selector-button {
    padding: 8px 16px;
    margin-right: 12px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-group input[type="file"]::file-selector-button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.alert-error {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1001;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 32px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-secondary);
}

/* Selection UI */
.selection-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.media-item:hover .selection-checkbox,
.media-item.selected .selection-checkbox {
    opacity: 1;
}

.media-select {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.media-item.selected {
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.media-item.selected img {
    opacity: 0.8;
}

/* Selection Action Bar */
.selection-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 90%;
}

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

.selection-info span {
    font-weight: 500;
    color: var(--text-primary);
}

.selection-actions {
    display: flex;
    gap: 8px;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.btn-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Drag and Drop */
.media-item.dragging {
    opacity: 0.5;
}

.folder-item.drop-target {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: scale(1.02);
}

.folder-item.drop-target .folder-icon {
    color: var(--bg-primary);
}

.folder-item.drop-target .folder-name {
    color: var(--bg-primary);
}

.drag-preview {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    min-width: 150px;
    padding: 4px 0;
    display: none;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 4px 0;
}

/* Share Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.modal-dialog {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1101;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-results {
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.search-result-item,
.shared-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-primary);
}

.search-result-item:last-child,
.shared-user-item:last-child {
    border-bottom: none;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info strong {
    color: var(--text-primary);
    font-size: 14px;
}

.user-email {
    color: var(--text-secondary);
    font-size: 12px;
}

.btn-add,
.btn-remove {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-weight: 500;
}

.btn-add {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.btn-add:hover {
    background: var(--accent-hover);
}

.btn-remove {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-remove:hover {
    background: var(--danger);
    color: var(--text-primary);
}

.shared-users-section {
    margin-top: 24px;
}

.shared-users-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: var(--text-primary);
}

.shared-users-list {
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-tertiary);
    min-height: 60px;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 16px;
    text-align: center;
    margin: 0;
}

.text-error {
    color: var(--danger);
    font-size: 13px;
    padding: 16px;
    text-align: center;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .gallery-item img {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item img {
        height: 200px;
    }
}
