/**
 * Tag System CSS
 *
 * Styles for the tag system in the Image Comments plugin.
 *
 * @package ImageComments
 * @subpackage Tags
 * @since 1.0.0
 */

/* Tags Container */
.ic-task-tags-container {
    margin: 15px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
}

.ic-task-tags-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #23282d;
}

/* Tags Display */
.ic-task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ic-task-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 20px; /* Pill shape */
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #fff; /* Default to white text */
    position: relative;
    overflow: hidden;
}

.ic-task-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ic-task-tag:hover::before {
    opacity: 1;
}

/* Tag Remove Button */
.ic-remove-tag {
    margin-left: 6px;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    opacity: 0.7;
    text-decoration: none;
    font-weight: bold;
    margin-right: -4px;
}

.ic-remove-tag:hover {
    opacity: 1;
    color: inherit;
    text-decoration: none;
}

.ic-remove-tag.ic-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Tag Selection */
.ic-add-tag-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.ic-tag-select {
    min-width: 200px;
    max-width: 100%;
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
    height: 36px;
}

.ic-add-tag-button {
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 36px;
    line-height: 1;
}

.ic-add-tag-button:hover {
    background-color: #006291;
}

.ic-add-tag-button.ic-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.ic-add-tag-button.ic-loading:after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ic-spin 1s ease-in-out infinite;
    position: absolute;
    right: 10px;
    top: calc(50% - 6px);
}

/* Premium Notice */
.ic-premium-notice {
    margin-top: 15px;
    padding: 10px 12px;
    background-color: #f0f6fc;
    border-left: 4px solid #007cba;
    color: #1e1e1e;
    font-size: 13px;
    line-height: 1.5;
}

.ic-premium-notice a {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
}

.ic-premium-notice a:hover {
    text-decoration: underline;
}

/* Notices */
.ic-tag-notice {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.ic-tag-notice-success {
    background-color: #ecf9ec;
    color: #1e8a1e;
    border: 1px solid #c3e6c3;
}

.ic-tag-notice-error {
    background-color: #f9ecec;
    color: #b32d2e;
    border: 1px solid #e6c3c3;
}

.ic-tag-notice-premium {
    background-color: #f0f6fc;
    color: #1e1e1e;
    border: 1px solid #c8d7e1;
}

.ic-premium-link {
    display: inline-block;
    background-color: #007cba;
    color: #fff !important;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 12px;
    text-decoration: none !important;
    margin-left: 6px;
}

.ic-premium-link:hover {
    background-color: #006ba1;
}

/* Tag Filter */
.ic-tag-filter {
    margin-bottom: 15px;
}

.ic-tag-filter label {
    margin-right: 8px;
    font-weight: 500;
}

.ic-filter-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Animation */
@keyframes ic-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Styles */
@media (max-width: 600px) {
    .ic-add-tag-container {
        flex-direction: column;
        align-items: stretch;
    }

    .ic-tag-select {
        width: 100%;
    }

    .ic-add-tag-button {
        align-self: flex-start;
    }
}

/* Select2 Integration */
.select2-container--default .select2-selection--single {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    height: 36px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px !important;
    padding-left: 10px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px !important;
}

.select2-dropdown {
    border-color: #ddd !important;
}

/* Custom color dropdown for Select2 */
.select2-ic-tag-option {
    display: flex;
    align-items: center;
}

.select2-ic-tag-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Gallery Tag Button */
.ic-gallery-item-tags {
    margin: 5px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding: 0 10px;
    width: 100%;
    position: relative;
}

.ic-tags-display-row {
    display: flex;
    width: calc(100% - 20px);
    align-items: center;
    gap: 10px;
    min-height: 43px;
}

.ic-gallery-item-tag-list {
    flex: 1;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.ic-gallery-tag-item {
    display: inline-flex;
    padding: 6px 11px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    background-color: #0073aa; /* Default color, will be overridden */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.ic-gallery-tag-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.ic-tag-separator {
    display: none; /* Hide separators as we're using pill tags */
}

.ic-add-tag-button-gallery {
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
    padding: 3px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

.ic-add-tag-button-gallery:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
}

.ic-add-tag-button-gallery:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ic-add-tag-button-gallery .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 0;
}

.ic-tag-count {
    background-color: #0073aa;
    color: #fff;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
}

/* Inline Tag Panel - Expansion style */
.ic-inline-tag-panel {
    width: 94%;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 10px;
    max-height: none;
    margin-top: 10px;
    margin-left: -10px;
    z-index: 100;
    position: relative;
    display: none; /* Hidden by default, shown via JS */
}

.ic-inline-tag-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ic-tag-panel-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
    text-align: center;
}

/* Clickable tags */
.ic-inline-all-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
    max-height: 180px;
    overflow-y: auto;
}

.ic-clickable-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 15px; /* Pill shape */
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease; /* More specific transitions */
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    color: #fff; /* Default to white text */
}
/*
.ic-clickable-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 0.2s ease;
} */

/* .ic-clickable-tag:hover::before {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
} */

.ic-clickable-tag.ic-tag-applied {
    /* Style for applied tags */
    padding-right: 26px; /* Space for the checkmark */
    transition: none; /* Disable transition when applying/removing tag */
}

.ic-tag-indicator {
    position: absolute;
    right: 8px;
    font-size: 10px;
    color: #fff; /* Will inherit text color based on background */
    background-color: rgba(255, 255, 255, 0.2);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.ic-clickable-tag.ic-loading {
    opacity: 0.7;
    pointer-events: none;
}

.ic-inline-tag-message {
    min-height: 0;
    font-size: 12px;
}

.ic-inline-tag-footer {
    display: flex;
    justify-content: flex-end;
}

.ic-inline-close-panel {
    background-color: #f7f7f7;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ic-inline-close-panel:hover {
    background-color: #f0f0f0;
}

.ic-premium-notice-inline {
    padding: 8px;
    background-color: #f0f6fc;
    border-left: 3px solid #007cba;
    color: #1e1e1e;
    font-size: 12px;
    line-height: 1.4;
}

.ic-premium-notice-inline a {
    color: #007cba;
    font-weight: 500;
    text-decoration: none;
}

.ic-premium-notice-inline a:hover {
    text-decoration: underline;
}

.ic-no-tags {
    color: #666;
    font-style: italic;
    font-size: 12px;
    padding: 5px;
    margin: 0;
}

.ic-loading {
    color: #666;
    font-style: italic;
    font-size: 12px;
}

.ic-error {
    color: #b32d2e;
    font-style: italic;
    font-size: 12px;
}

/* Keep message styles more compact */
.ic-tag-message {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.3;
    margin: 0;
}

.ic-tag-message-error {
    background-color: #f9ecec;
    color: #b32d2e;
    border: 1px solid #e6c3c3;
}

/* Responsive Styles for Inline Panel */
@media (max-width: 600px) {
    .ic-inline-tag-panel {
        width: 94%;
        padding: 10px;
    }

    .ic-inline-all-tags {
        max-height: 150px;
    }

    .ic-clickable-tag {
        font-size: 11px;
        padding: 3px 8px;
    }
}
