/**
 * Shape Library Styles
 *
 * @package PrintShopStudio
 */

/* Shape Library Panel */
.pss-shape-library-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.pss-shape-library-panel.pss-panel-open {
    right: 0;
}

/* Panel Header */
.pss-shape-library-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pss-shape-library-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pss-shape-library-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.pss-shape-library-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Category Tabs */
.pss-shape-categories {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pss-shape-category-btn {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pss-shape-category-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.pss-shape-category-btn.pss-active {
    background: #9b59b6;
    border-color: #9b59b6;
    color: #fff;
}

/* Category Dropdown (Mobile) */
.pss-shape-category-select {
    display: none;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

@media (max-width: 500px) {
    .pss-shape-categories .pss-shape-category-btn {
        display: none;
    }

    .pss-shape-category-select {
        display: block;
    }
}

/* Shape Grid */
.pss-shape-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.pss-shape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pss-shape-item {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    position: relative;
}

.pss-shape-item:hover {
    border-color: #9b59b6;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.15);
}

.pss-shape-item.pss-selected {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.1);
}

.pss-shape-item svg {
    width: 50px;
    height: 50px;
    color: #2c3e50;
    transition: color 0.2s;
}

.pss-shape-item svg [fill="currentColor"] {
    fill: #2c3e50;
}

.pss-shape-item svg [stroke="currentStroke"] {
    stroke: #34495e;
}

.pss-shape-item:hover svg {
    color: #9b59b6;
}

.pss-shape-item-name {
    font-size: 10px;
    color: #666;
    margin-top: 8px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Loading State */
.pss-shape-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.pss-shape-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #9b59b6;
    border-radius: 50%;
    animation: pss-shape-spin 0.8s linear infinite;
}

@keyframes pss-shape-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer Actions */
.pss-shape-library-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

/* Preview Area */
.pss-shape-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 100px;
}

.pss-shape-preview svg {
    width: 80px;
    height: 80px;
}

.pss-shape-preview-empty {
    color: #aaa;
    font-size: 13px;
}

/* Colour Controls */
.pss-shape-colours {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.pss-shape-colour-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pss-shape-colour-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.pss-shape-colour-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pss-shape-colour-input {
    width: 36px;
    height: 30px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.pss-shape-colour-hex {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.pss-shape-no-fill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.pss-shape-no-fill input {
    margin: 0;
}

/* Stroke Width */
.pss-shape-stroke-group {
    margin-bottom: 16px;
}

.pss-shape-stroke-group label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    margin-bottom: 6px;
}

.pss-shape-stroke-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pss-shape-stroke-input {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
}

.pss-shape-stroke-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #9b59b6;
    cursor: pointer;
}

.pss-shape-stroke-value {
    width: 50px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
}

/* Size Control */
.pss-shape-size-group {
    margin-bottom: 16px;
}

.pss-shape-size-group label {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 500;
    margin-bottom: 6px;
}

.pss-shape-size-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pss-shape-size-input {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

/* Add Button */
.pss-shape-add-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pss-shape-add-btn:hover {
    background: linear-gradient(135deg, #219a52 0%, #27ae60 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.pss-shape-add-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Toolbar Button */
.pss-toolbar-shape-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.pss-toolbar-shape-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.pss-toolbar-shape-btn svg {
    width: 18px;
    height: 18px;
}

/* Panel Overlay */
.pss-shape-library-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.pss-shape-library-overlay.pss-visible {
    opacity: 1;
    visibility: visible;
}

/* Responsive */
@media (max-width: 768px) {
    .pss-shape-library-panel {
        width: 100%;
        right: -100%;
    }

    .pss-shape-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .pss-shape-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pss-shape-colours {
        grid-template-columns: 1fr;
    }
}

/* Tooltip */
.pss-shape-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #2c3e50;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 100;
}

.pss-shape-item:hover .pss-shape-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

.pss-shape-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
}

/* Category Dividers in Grid */
.pss-shape-category-divider {
    grid-column: 1 / -1;
    padding: 8px 0;
    margin-top: 8px;
    border-top: 1px solid #eee;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pss-shape-category-divider:first-child {
    border-top: none;
    margin-top: 0;
}











