/**
 * GGM Commerce Icon Picker Styles
 *
 * @package GGM_Commerce
 */

/* Modal overlay and container */
.ggmc-icon-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100100;
}

.ggmc-icon-picker-modal.open {
    display: block;
}

.ggmc-icon-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.ggmc-icon-picker-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.ggmc-modal-open {
    overflow: hidden;
}

/* Header */
.ggmc-icon-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    background: #f6f7f7;
}

.ggmc-icon-picker-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.ggmc-icon-picker-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.ggmc-icon-picker-close:hover {
    background: #ddd;
    color: #333;
}

/* Tabs */
.ggmc-icon-picker-tabs {
    display: flex;
    padding: 0 20px;
    background: #f6f7f7;
    border-bottom: 1px solid #ddd;
}

.ggmc-icon-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.ggmc-icon-tab:hover {
    color: #2271b1;
}

.ggmc-icon-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
    background: #fff;
}

/* Content area */
.ggmc-icon-picker-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ggmc-icon-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

.ggmc-icon-tab-content.active {
    display: flex;
}

/* Search */
.ggmc-icon-picker-search {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.ggmc-icon-search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ggmc-icon-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Categories */
.ggmc-icon-picker-categories {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.ggmc-category-btn {
    background: #f0f0f1;
    border: 1px solid #ddd;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: #50575e;
}

.ggmc-category-btn:hover {
    background: #e0e0e0;
}

.ggmc-category-btn.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* Icon grid */
.ggmc-icon-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 8px;
    align-content: start;
}

.ggmc-icon-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #50575e;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.ggmc-icon-item:hover {
    background: #f0f6fc;
    border-color: #2271b1;
    color: #2271b1;
}

.ggmc-icon-item.selected {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.ggmc-no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-size: 14px;
}

/* SVG Upload */
.ggmc-svg-upload-area {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ggmc-svg-dropzone {
    width: 100%;
    max-width: 400px;
    padding: 60px 40px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.ggmc-svg-dropzone:hover,
.ggmc-svg-dropzone.dragover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ggmc-svg-dropzone i {
    font-size: 48px;
    color: #2271b1;
    margin-bottom: 16px;
    display: block;
}

.ggmc-svg-dropzone p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.ggmc-svg-file-input {
    display: none;
}

.ggmc-svg-preview {
    text-align: center;
}

.ggmc-svg-preview-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 20px;
}

.ggmc-svg-preview-icon img {
    max-width: 100%;
    max-height: 100%;
}

.ggmc-svg-remove {
    background: #d63638;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.ggmc-svg-remove:hover {
    background: #b32d2e;
}

/* Media Library Tab */
.ggmc-media-library-area {
    flex: 1;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ggmc-media-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.ggmc-open-media-library {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px !important;
    font-size: 14px !important;
}

.ggmc-open-media-library .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ggmc-media-preview {
    margin-top: 30px;
    text-align: center;
}

.ggmc-media-preview-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 16px;
}

.ggmc-media-preview-icon img {
    max-width: 100%;
    max-height: 100%;
}

.ggmc-media-filename {
    display: block;
    font-size: 13px;
    color: #666;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Presets Tab */
.ggmc-presets-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.ggmc-presets-description {
    text-align: center;
    color: #666;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.ggmc-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.ggmc-preset-group-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ggmc-preset-group-item:hover {
    border-color: #2271b1;
    background: #f0f6fc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ggmc-preset-group-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #2271b1;
    background: #f0f6fc;
    border-radius: 50%;
    margin-bottom: 12px;
}

.ggmc-preset-group-item:hover .ggmc-preset-group-icon {
    background: #2271b1;
    color: #fff;
}

.ggmc-preset-group-name {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.ggmc-preset-group-count {
    font-size: 12px;
    color: #666;
}

/* Preset Attributes View */
.ggmc-preset-attributes {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ggmc-preset-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.ggmc-preset-back {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #50575e;
    transition: all 0.2s;
}

.ggmc-preset-back:hover {
    background: #f0f0f1;
    border-color: #2271b1;
    color: #2271b1;
}

.ggmc-preset-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.ggmc-preset-title i {
    color: #2271b1;
    margin-right: 8px;
}

.ggmc-preset-attrs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.ggmc-preset-attr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.ggmc-preset-attr-item:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ggmc-preset-attr-item.selected {
    border-color: #2271b1;
    background: #2271b1;
}

.ggmc-preset-attr-item.selected .ggmc-preset-attr-icon,
.ggmc-preset-attr-item.selected .ggmc-preset-attr-name {
    color: #fff;
}

.ggmc-preset-attr-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #2271b1;
    background: #f0f6fc;
    border-radius: 4px;
    flex-shrink: 0;
}

.ggmc-preset-attr-item.selected .ggmc-preset-attr-icon {
    background: rgba(255, 255, 255, 0.2);
}

.ggmc-preset-attr-name {
    font-size: 13px;
    color: #1d2327;
    font-weight: 500;
}

.ggmc-preset-attr-unit {
    font-weight: 400;
    color: #666;
}

.ggmc-preset-attr-item.selected .ggmc-preset-attr-unit {
    color: rgba(255, 255, 255, 0.8);
}

/* Footer */
.ggmc-icon-picker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid #ddd;
    background: #f6f7f7;
}

.ggmc-icon-picker-selected {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ggmc-selected-icon-preview {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 20px;
    color: #50575e;
}

.ggmc-selected-icon-preview img {
    max-width: 28px;
    max-height: 28px;
}

.ggmc-selected-icon-name {
    font-size: 13px;
    color: #666;
}

.ggmc-icon-picker-actions {
    display: flex;
    gap: 10px;
}

.ggmc-icon-picker-actions .button {
    padding: 6px 16px;
}

/* Icon picker field in forms */
.ggmc-icon-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ggmc-icon-preview {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 18px;
    color: #666;
}

.ggmc-icon-preview img {
    max-width: 24px;
    max-height: 24px;
}

.ggmc-icon-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f6f7f7;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3338;
    transition: all 0.1s;
}

.ggmc-icon-picker-trigger:hover {
    background: #f0f0f1;
    border-color: #2271b1;
    color: #2271b1;
}

.ggmc-icon-value {
    display: none;
}

/* Responsive */
@media (max-width: 600px) {
    .ggmc-icon-picker-container {
        width: 95%;
        max-height: 90vh;
    }

    .ggmc-icon-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    }

    .ggmc-icon-picker-footer {
        flex-direction: column;
        gap: 12px;
    }

    .ggmc-icon-picker-selected {
        width: 100%;
    }

    .ggmc-icon-picker-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
