/**
 * PS5 Icon System Styles
 * 
 * Base styling for the PS5 theme icon system.
 * Provides consistent icon display across blocks and components.
 */


.ps-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: currentColor; /* Inherit text color by default */
    line-height: 1;
}

.ps-icon svg {
    display: block;
    fill: currentColor;
    width: var(--ps-icon-size, 16px);
    height: var(--ps-icon-size, 16px);
    transition: all 0.2s ease;
}

.ps-icon--small {
    --ps-icon-size: 14px;
}

.ps-icon--medium {
    --ps-icon-size: 16px;
}

.ps-icon--large {
    --ps-icon-size: 20px;
}

.ps-icon--custom-size {
    --ps-icon-size: var(--ps-icon-custom-size, 16px);
}

.ps-icon--custom-color {
    color: var(--ps-icon-color, currentColor);
}

.ps-icon--left {
    margin-right: 0.5em;
}

.ps-icon--right {
    margin-left: 0.5em;
}

.ps-icon--top {
    margin-bottom: 0.25em;
}

.ps-icon--bottom {
    margin-top: 0.25em;
}

.ps-icon-picker {
    margin-bottom: 16px;
}

.ps-icon-picker__control {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.ps-icon-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
}

.ps-icon-picker__clear {
    min-width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 1;
}

.ps-icon-picker__preview {
    margin-top: 8px;
    padding: 8px;
    background: #f6f7f7;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ps-icon-picker__preview-label {
    color: #757575;
    font-weight: 500;
}

.ps-icon-picker-modal .components-modal__content {
    padding: 0;
    margin: 0;
    width: 600px;
    max-width: 90vw;
    height: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.ps-icon-picker-modal__content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.ps-icon-picker-modal__filters {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e4e7;
}

.ps-icon-picker-modal__search {
    flex: 2;
}

.ps-icon-picker-modal__category {
    flex: 1;
}

.ps-icon-picker-modal__grid {
    flex: 1;
    overflow-y: auto;
}

.ps-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 4px;
}

.ps-icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #f6f7f7;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 80px;
}

.ps-icon-option:hover {
    background: #e7f3ff;
    border-color: #007cba;
}

.ps-icon-option--selected {
    background: #007cba;
    color: white;
    border-color: #005a87;
}

.ps-icon-option__icon {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
}

.ps-icon-option__name {
    font-size: 12px;
    line-height: 1.3;
    word-break: break-word;
    max-width: 100%;
}

.ps-icon-grid-empty {
    text-align: center;
    color: #757575;
    font-style: italic;
    padding: 40px 20px;
}

.ps-icon-size-control {
    margin-bottom: 16px;
}

.ps-icon-size-control .components-text-control__input {
    max-width: 120px;
}

.ps-icon-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.ps-icon-picker-error,
.ps-icon-select-error {
    padding: 12px;
    background: #fcf2f2;
    border: 1px solid #cc1818;
    border-radius: 4px;
    color: #cc1818;
    font-size: 14px;
}

@media (max-width: 768px) {
    .ps-icon-picker-modal .components-modal__content {
        width: 95vw;
        height: 70vh;
    }

    .ps-icon-picker-modal__filters {
        flex-direction: column;
        gap: 12px;
    }

    .ps-icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .ps-icon-option {
        padding: 8px 4px;
        min-height: 70px;
    }

    .ps-icon-option__name {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .ps-icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    .ps-icon-option {
        padding: 6px 4px;
        min-height: 60px;
    }

    .ps-icon-picker__control {
        flex-direction: column;
        align-items: stretch;
    }

    .ps-icon-picker-trigger {
        justify-content: center;
    }
}

@media print {
    .ps-icon {
        color: #000 !important;
    }

    .ps-icon svg {
        fill: #000 !important;
    }
}


@media (prefers-contrast: high) {
    .ps-icon-option {
        border-width: 3px;
    }

    .ps-icon-option:hover,
    .ps-icon-option--selected {
        border-color: #000;
        background: #fff;
        color: #000;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ps-icon,
    .ps-icon svg,
    .ps-icon-option {
        transition: none;
    }
}