/* My Resources Page Styles */

.login-container {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 3rem;
    text-align: center;
    max-width: 400px;
}

.login-card h2 {
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Resources Container */
.resources-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.resources-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.resources-title h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.resources-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Toolbar */
.resources-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    height: 36px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.1);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-group select {
    min-width: 140px;
    height: 36px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    box-sizing: border-box;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.1);
}

/* Folders Section */
.folders-section {
    margin-bottom: 2rem;
}

.folders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.folders-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.folder-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}

.folder-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.folder-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.folder-card-content {
    flex: 1;
    min-width: 0;
}

.folder-card-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-card-count {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.folder-card-menu {
    position: relative;
    opacity: 0;
    transition: opacity 0.15s;
}

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

.folder-card-menu .menu-btn {
    font-size: 1rem;
    padding: 0.125rem 0.25rem;
}

.folder-card-menu .menu-dropdown {
    right: 0;
    top: 100%;
    min-width: 120px;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px currentColor;
}

/* Form Label */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Resources Grid */
.resources-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Resource Card */
.resource-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.resource-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.resource-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--background);
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.status-badge.published {
    background: #dcfce7;
    color: #166534;
}

.status-badge.private {
    background: var(--background-warm);
    color: var(--text-secondary);
}

/* Menu */
.resource-menu {
    position: relative;
}

.menu-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.menu-btn:hover {
    background: var(--background-warm);
    color: var(--text-primary);
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 100;
    display: none;
}

.menu-dropdown.open {
    display: block;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
}

.menu-item:hover {
    background: var(--background-warm);
}

.menu-item.danger {
    color: var(--error-color);
}

.menu-item.danger:hover {
    background: #fee2e2;
}

/* Card Body */
.resource-card-body {
    display: block;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
}

.resource-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.resource-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.resource-date {
    font-size: 0.75rem;
    color: var(--text-tertiary, #999);
}

/* Card Footer */
.resource-card-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--background);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--background-warm);
    border-color: var(--primary-color);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin-bottom: 0.5rem;
}

.warning-text {
    color: var(--error-color);
    font-size: 0.875rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.2s ease-out;
}

.toast.error {
    background: var(--error-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Share Modal */
.share-modal {
    max-width: 550px;
}

.share-section {
    margin-bottom: 1.5rem;
}

.share-section:last-child {
    margin-bottom: 0;
}

.share-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.share-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* Public Link Toggle */
.share-toggle {
    margin-bottom: 0.75rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-label input:checked + .toggle-switch {
    background: var(--primary-color);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(20px);
}

.toggle-text {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.public-link-section {
    margin-top: 0.75rem;
}

.public-link-section.hidden {
    display: none;
}

.link-input-group {
    display: flex;
    gap: 0.5rem;
}

.link-input-group input {
    flex: 1;
    font-size: 0.8125rem;
    background: var(--background-warm);
    color: var(--text-secondary);
}

/* Share Input */
.share-input-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-input-group input[type="email"] {
    flex: 1;
    min-width: 200px;
}

.share-input-group select {
    width: auto;
}

/* Shares List */
.shares-list {
    max-height: 250px;
    overflow-y: auto;
}

.shares-loading,
.shares-empty,
.shares-error {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.shares-error {
    color: var(--error-color);
}

.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: background 0.1s;
}

.share-item:hover {
    background: var(--background-warm);
}

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

.share-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.share-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.share-name {
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.share-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.share-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.share-permission {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
    min-width: auto;
}

.btn-icon {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
}

.btn-icon:hover {
    background: #fee2e2;
    color: var(--error-color);
}

/* Selection UI */
.resource-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 24px;
    height: 24px;
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.15s;
}

.resource-card {
    position: relative;
}

.resource-card:hover .resource-checkbox,
.resource-card.selected .resource-checkbox {
    opacity: 1;
}

.resource-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    pointer-events: none; /* Let clicks go through to parent div handler */
}

.resource-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Floating Selection Action Bar */
.selection-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
}

.selection-action-bar.visible {
    transform: translateY(0);
}

.selection-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
}

.select-all-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.selection-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selection-action-bar .btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.selection-action-bar .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.selection-action-bar .btn-danger {
    background: var(--error-color);
    border-color: var(--error-color);
}

.selection-action-bar .btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-icon-text {
    margin-right: 0.25rem;
}

.selection-cancel {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.selection-cancel:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .resources-container {
        padding: 1rem;
    }

    .resources-header {
        flex-direction: column;
        gap: 1rem;
    }

    .folders-grid {
        grid-template-columns: 1fr;
    }

    .folder-card-menu {
        opacity: 1;
    }

    .resources-actions {
        width: 100%;
    }

    .resources-actions .btn {
        width: 100%;
    }

    .resources-toolbar {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select {
        flex: 1;
    }

    .resources-list {
        grid-template-columns: 1fr;
    }

    /* Share modal responsive */
    .share-modal {
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .share-input-group {
        flex-direction: column;
    }

    .share-input-group input[type="email"],
    .share-input-group select,
    .share-input-group button {
        width: 100%;
    }

    .share-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .share-actions {
        width: 100%;
        justify-content: space-between;
    }

    .share-permission {
        flex: 1;
    }

    /* Selection bar responsive */
    .selection-action-bar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .selection-bar-left {
        width: 100%;
        justify-content: space-between;
    }

    .selection-bar-actions {
        flex: 1;
        justify-content: center;
        flex-wrap: wrap;
    }

    .selection-cancel {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Show checkbox always on mobile */
    .resource-checkbox {
        opacity: 1;
    }
}
