/* Category Grid Modal Styles */
/* Comprehensive category overview in modal format */

/* Modal Overlay */
.category-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Container */
.category-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.modal-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
}

.modal-search i {
    color: rgba(255, 255, 255, 0.5);
    margin-right: 8px;
}

.modal-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.modal-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #fff;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    padding: 16px 20px;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
}

.tab-btn.active {
    background: rgba(74, 158, 255, 0.2);
    border-color: #4a9eff;
    color: #4a9eff;
}

/* Modal Body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.view-container {
    display: none;
}

.view-container.active {
    display: block;
}

/* Grid View */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.category-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.category-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(74, 158, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.card-icon {
    font-size: 24px;
    margin-right: 8px;
}

.card-header h3 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

.selected-badge {
    background: #4a9eff;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.card-stats {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tool-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.card-categories {
    margin-bottom: 12px;
}

.card-category {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.card-category:hover {
    background: rgba(255, 255, 255, 0.05);
}

.card-category.selected {
    background: rgba(74, 158, 255, 0.1);
}

.category-check {
    margin-right: 8px;
}

.cat-name {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.card-category.selected .cat-name {
    color: #4a9eff;
}

.cat-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 10px;
}

.card-actions {
    margin-top: 12px;
}

.select-all-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-all-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Hierarchy View */
.hierarchy-tree {
    max-width: 800px;
    margin: 0 auto;
}

.hierarchy-group {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.hierarchy-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hierarchy-icon {
    font-size: 20px;
    margin-right: 12px;
}

.hierarchy-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

.hierarchy-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

.hierarchy-children {
    padding: 8px;
}

.hierarchy-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hierarchy-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hierarchy-item.selected {
    background: rgba(74, 158, 255, 0.1);
}

.item-name {
    flex: 1;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 8px;
}

.hierarchy-item.selected .item-name {
    color: #4a9eff;
}

.item-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

/* Modal Footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.selection-info {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.selected-count {
    font-weight: 500;
    color: #4a9eff;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.btn-secondary,
.btn-primary {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-primary {
    background: #4a9eff;
    color: #fff;
}

.btn-primary:hover {
    background: #3a8eef;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

/* Body Modal Open State */
body.modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .category-modal {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        flex-direction: column;
        gap: 12px;
    }

    .modal-search {
        max-width: 100%;
        margin: 0;
    }

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

    .modal-footer {
        flex-direction: column;
        gap: 12px;
    }

    .modal-actions {
        width: 100%;
    }

    .btn-secondary,
    .btn-primary {
        flex: 1;
    }
}