/**
 * Taxonomy Terms Table Styles
 * Ferrari-inspired red theme
 */

/* Variables */
:root {
    --ferrari-red: #FF2800;
    --ferrari-dark-red: #D40000;
    --ferrari-yellow: #FFF200;
    --text-dark: #333333;
    --text-light: #FFFFFF;
    --border-color: #E0E0E0;
    --gray-light: #F5F5F5;
    --gray-medium: #E0E0E0;
    --gray-dark: #999999;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Container */
.taxonomy-terms-table-container {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    max-width: 100%;
    margin: 2em 0;
    padding: 0;
    color: var(--text-dark);
}

.taxonomy-terms-table-container h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 1em;
    color: var(--ferrari-red);
    border-bottom: 2px solid var(--ferrari-red);
    padding-bottom: 0.5em;
}

/* Add New Term Button */
.add-new-term-button {
    background-color: var(--ferrari-red);
    color: var(--text-light);
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1.5em;
    display: inline-block;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-new-term-button:hover {
    background-color: var(--ferrari-dark-red);
}

.add-new-term-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 40, 0, 0.3);
}

/* Table Styles */
.taxonomy-terms-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 2em;
    background-color: #FFFFFF;
    overflow: hidden;
}

.taxonomy-terms-table th {
    background-color: var(--ferrari-red);
    color: var(--text-light);
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.taxonomy-terms-table th:first-child {
    border-top-left-radius: 6px;
}

.taxonomy-terms-table th:last-child {
    border-top-right-radius: 6px;
    text-align: center;
}

.taxonomy-terms-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.taxonomy-terms-table tr:last-child td {
    border-bottom: none;
}

.taxonomy-terms-table tr:hover {
    background-color: var(--gray-light);
}

/* Term Image Styles */
.term-image-cell {
    width: 100px;
}

.term-image-container {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background-color: var(--gray-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.term-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.no-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--gray-dark);
    font-size: 12px;
    text-align: center;
    padding: 5px;
}

.no-image-placeholder.active {
    display: flex;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    font-size: 12px;
    text-align: center;
    padding: 5px;
}

.term-image-container:hover .upload-overlay {
    opacity: 1;
}

.term-image-container.dragging {
    border-color: var(--ferrari-red);
    box-shadow: 0 0 0 2px rgba(255, 40, 0, 0.3);
}

/* Term Name Cell */
.term-name-cell {
    font-weight: 500;
}

.term-name-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--ferrari-red);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}

.term-name-input:focus {
    box-shadow: 0 0 0 2px rgba(255, 40, 0, 0.2);
}

/* Action Buttons */
.term-actions-cell {
    width: 120px;
    text-align: center;
}

.term-actions-cell button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin: 0 2px;
}

.edit-term-button:hover {
    background-color: rgba(255, 40, 0, 0.1);
}

.save-term-button {
    color: #4CAF50;
}

.save-term-button:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

.cancel-edit-button {
    color: var(--gray-dark);
}

.cancel-edit-button:hover {
    background-color: rgba(153, 153, 153, 0.1);
}

.delete-term-button {
    color: var(--ferrari-red);
}

.delete-term-button:hover {
    background-color: rgba(255, 40, 0, 0.1);
}

.term-actions-cell .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: block;
}

/* Modal Styles */
.term-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.term-modal.active {
    display: flex;
}

.term-modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-dark);
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--ferrari-red);
}

.term-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--ferrari-red);
    font-size: 20px;
    border-bottom: 2px solid var(--ferrari-red);
    padding-bottom: 10px;
}

.term-form {
    display: flex;
    flex-direction: column;
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-row input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.form-row input[type="text"]:focus {
    border-color: var(--ferrari-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 40, 0, 0.2);
}

.new-term-image-container {
    width: 120px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background-color: var(--gray-light);
    border: 1px dashed var(--border-color);
    cursor: pointer;
}

.new-term-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.new-term-image-container .no-image-placeholder {
    font-size: 14px;
}

.new-term-image-container:hover {
    border-color: var(--ferrari-red);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

#create-term-button {
    background-color: var(--ferrari-red);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#create-term-button:hover {
    background-color: var(--ferrari-dark-red);
}

#create-term-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 40, 0, 0.3);
}

/* Notification */
.taxonomy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 300px;
}

.taxonomy-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.taxonomy-notification.success {
    background-color: #4CAF50;
    color: white;
}

.taxonomy-notification.error {
    background-color: var(--ferrari-red);
    color: white;
}

/* Loader */
.taxonomy-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.taxonomy-loader.show {
    opacity: 1;
    visibility: visible;
}

.taxonomy-loader .spinner {
    border: 4px solid rgba(255, 40, 0, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--ferrari-red);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}