/**
 * Admin styles for Image Sources Manager
 *
 * @package Image_Sources_Manager
 */

/* Menu icon styling */
#adminmenu .toplevel_page_eiam-sources .wp-menu-image:before {
    content: "\f233";
}

/* Page header styling */
.eiam-header {
    background: #f1f1f1;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.eiam-header h3 {
    margin-top: 0;
    color: #23282d;
}

.eiam-header p {
    margin-bottom: 0;
    color: #666;
}

/* Admin list table styling */
.wp-list-table .eiam-thumbnail {
    width: 60px;
    text-align: center;
}

.wp-list-table .eiam-thumbnail img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.wp-list-table .eiam-no-thumbnail {
    width: 50px;
    height: 50px;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #646970;
    text-align: center;
}

.wp-list-table .eiam-no-usage {
    color: #646970;
    font-style: italic;
}

.wp-list-table .eiam-never-used {
    color: #646970;
    font-style: italic;
}

.wp-list-table .eiam-missing {
    color: #d63638;
    font-style: italic;
}

.wp-list-table .eiam-complete {
    color: #00a32a;
    font-weight: 500;
}

/* Column widths */
.wp-list-table .column-thumbnail {
    width: 80px;
}

.wp-list-table .column-file {
    width: 200px;
}

.wp-list-table .column-author {
    width: 150px;
}

.wp-list-table .column-source {
    width: 120px;
}

.wp-list-table .column-license {
    width: 150px;
}

.wp-list-table .column-usage {
    width: 200px;
}

.wp-list-table .column-last_seen {
    width: 120px;
}

/* No items message */
.eiam-no-items-message {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.eiam-no-items-message p {
    margin: 0 0 10px 0;
}

.eiam-no-items-message ul {
    text-align: left;
    display: inline-block;
    margin: 10px 0;
}

.eiam-no-items-message li {
    margin-bottom: 5px;
}

/* Statistics boxes */
.eiam-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.eiam-stat-box {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    min-width: 120px;
    flex: 1;
}

.eiam-stat-box h3 {
    margin: 0 0 5px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1d2327;
}

.eiam-stat-box p {
    margin: 0;
    color: #646970;
    font-size: 14px;
}

/* List table styles */
.eiam-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.eiam-no-thumbnail {
    width: 50px;
    height: 50px;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #646970;
    text-align: center;
}

.eiam-field {
    position: relative;
}

.eiam-field.eiam-missing {
    color: #d63638;
}

.eiam-missing-label {
    color: #d63638;
    font-style: italic;
}

.eiam-no-usage {
    color: #646970;
    font-style: italic;
}

.eiam-never-used {
    color: #646970;
    font-style: italic;
}

/* Search form */
.eiam-search-form {
    margin: 20px 0;
}

/* Bulk edit modal */
.eiam-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.eiam-modal-content {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.eiam-modal-header {
    padding: 20px;
    border-bottom: 1px solid #ccd0d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eiam-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.eiam-modal-close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #646970;
    line-height: 1;
}

.eiam-modal-close:hover {
    color: #1d2327;
}

.eiam-modal-body {
    padding: 20px;
}

.eiam-modal-footer {
    padding: 20px;
    border-top: 1px solid #ccd0d4;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.eiam-form-group {
    margin-bottom: 20px;
}

.eiam-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.eiam-form-group input,
.eiam-form-group textarea {
    width: 100%;
}

/* Loading states */
.eiam-loading {
    opacity: 0.6;
    pointer-events: none;
}

.eiam-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: eiam-spin 1s linear infinite;
}

@keyframes eiam-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .eiam-stats {
        flex-direction: column;
    }
    
    .eiam-stat-box {
        min-width: auto;
    }
    
    .eiam-modal-content {
        width: 95%;
        margin: 20px;
    }
}

/* WordPress admin compatibility */
.wp-admin .eiam-stats .eiam-stat-box {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.wp-admin .eiam-modal-content {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .eiam-field.eiam-missing {
        border: 1px solid currentColor;
        padding: 2px 4px;
    }
    
    .eiam-missing-label {
        font-weight: bold;
    }
}

/* License type dropdown styling */
.eiam-license-type-select {
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3338;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.eiam-license-type-select:hover {
    border-color: #1d2327;
}

.eiam-license-type-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
    outline-offset: 0;
}

.eiam-license-type-select option {
    padding: 8px 12px;
}

.eiam-license-type-select option:first-child {
    color: #646970;
    font-style: italic;
}

/* Custom license field container */
#eiam_settings_default_license_custom {
    margin-top: 4px;
}

/* Responsive license dropdown */
@media (max-width: 782px) {
    .eiam-license-type-select {
        width: 100% !important;
        min-width: auto !important;
        max-width: 100%;
    }
}

/* ARIA and accessibility improvements */
.eiam-license-type-select[aria-invalid="true"] {
    border-color: #d63638;
}

.eiam-license-type-select[aria-invalid="true"]:focus {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
}

/* Dark mode support for license dropdown */
@media (prefers-color-scheme: dark) {
    .eiam-license-type-select {
        background-color: #1d2327;
        border-color: #50575e;
        color: #f0f0f1;
    }
    
    .eiam-license-type-select:hover {
        border-color: #8c8f94;
    }
    
    .eiam-license-type-select:focus {
        border-color: #4f94d4;
        box-shadow: 0 0 0 1px #4f94d4;
    }
    
    .eiam-license-type-select option:first-child {
        color: #a7aaad;
    }
}

/* Default Values Toggle - Initially hidden, shown by JavaScript when checkbox is checked */
.eiam-default-value-field {
    display: none;
}

/* Attribution Helper Styling */
.eiam-attribution-helper {
    margin: 0;
    padding: 0;
}

.eiam-attribution-source {
    padding: 6px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #2c3338;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.eiam-attribution-source:hover {
    border-color: #1d2327;
}

.eiam-attribution-source:focus {
    border-color: #2271b1;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 1px #2271b1;
}

.eiam-attribution-snippet {
    padding: 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.eiam-attribution-snippet:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.eiam-attribution-help {
    font-size: 13px;
    line-height: 1.6;
}

.eiam-attribution-help strong {
    color: #1d2327;
}

.eiam-attribution-help a {
    color: #2271b1;
    text-decoration: none;
}

.eiam-attribution-help a:hover {
    text-decoration: underline;
}

.eiam-parse-success {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media modal specific styling */
.media-modal .eiam-attribution-helper {
    width: 100%;
}

.media-modal .eiam-attribution-source,
.media-modal .eiam-attribution-snippet {
    width: 100%;
    box-sizing: border-box;
}

/* Responsive for media modal */
@media (max-width: 782px) {
    .eiam-attribution-source,
    .eiam-attribution-snippet {
        font-size: 16px; /* Prevent zoom on mobile */
    }
}
