/**
 * WC Licensed Product - Admin Styles
 *
 * @package Jeremias\WcLicensedProduct
 */

/* License Status Badges */
.license-status {
    display: inline-block;
    padding: 0.2em 0.5em;
    font-size: 0.85em;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 3px;
}

.license-status-active {
    background-color: #d4edda;
    color: #155724;
}

.license-status-inactive {
    background-color: #fff3cd;
    color: #856404;
}

.license-status-expired {
    background-color: #f8d7da;
    color: #721c24;
}

.license-status-revoked {
    background-color: #d6d8db;
    color: #383d41;
}

/* License Table */
.wp-list-table code {
    font-family: monospace;
    background-color: #f0f0f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

/* File Hash */
code.file-hash {
    cursor: help;
    font-size: 0.85em;
    color: #666;
}

/* License Product Tab */
#woocommerce-product-data .show_if_licensed {
    display: block !important;
}

#woocommerce-product-data .hide_if_licensed {
    display: none !important;
}

/* Action Buttons */
.wp-list-table .button-link-delete {
    color: #a00;
}

.wp-list-table .button-link-delete:hover {
    color: #dc3232;
}

/* Pagination */
.tablenav-pages .pagination-links {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.tablenav-pages .paging-input {
    margin: 0 0.5em;
}

/* Orders Column */
.column-license {
    width: 15%;
}

.column-license .dashicons {
    vertical-align: middle;
    margin-right: 0.3em;
}

.column-license .dashicons-warning {
    color: #dba617;
}

.column-license .dashicons-admin-network {
    color: #2271b1;
}

/* Version Status Badges */
.version-status {
    display: inline-block;
    padding: 0.2em 0.5em;
    font-size: 0.85em;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 3px;
}

.version-status-active {
    background-color: #d4edda;
    color: #155724;
}

.version-status-inactive {
    background-color: #fff3cd;
    color: #856404;
}

/* Version Meta Box */
.wc-licensed-product-versions .versions-add-form {
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin-bottom: 20px;
}

.wc-licensed-product-versions .versions-add-form h4 {
    margin-top: 0;
}

.wc-licensed-product-versions .form-table {
    margin: 0;
}

.wc-licensed-product-versions .form-table th {
    padding: 10px 10px 10px 0;
    width: 120px;
}

.wc-licensed-product-versions .form-table td {
    padding: 10px 0;
}

#versions-table {
    margin-top: 10px;
}

#versions-table .no-versions td {
    text-align: center;
    font-style: italic;
    color: #666;
}

/* File Upload UI */
.selected-file-name {
    display: inline-block;
    margin-right: 10px;
    padding: 5px 10px;
    background: #e7f3ff;
    border-radius: 3px;
    font-weight: 500;
}

.selected-file-name:empty {
    display: none;
}

/* Version download link - keep filename and icon on single line */
.version-download-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.version-download-link .dashicons-media-archive {
    color: #2271b1;
    flex-shrink: 0;
    margin-left: 5px;
}

#versions-table .dashicons-media-archive {
    color: #2271b1;
    vertical-align: middle;
    margin-left: 5px;
}

/* Licenses Table Bulk Actions */
.licenses-table {
    margin-top: 0;
}

.licenses-table .check-column {
    width: 2.2em;
    padding: 0.5em;
}

.licenses-table .license-actions {
    width: 150px;
}

.licenses-table .row-actions {
    visibility: visible !important;
    position: static !important;
    padding: 2px 0 0;
}

.licenses-table .row-actions a {
    text-decoration: none;
}

.licenses-table .row-actions .submitdelete {
    color: #b32d2e;
}

.licenses-table .row-actions .submitdelete:hover {
    color: #dc3232;
}

/* Lifetime Badge */
.license-lifetime {
    display: inline-block;
    padding: 0.2em 0.5em;
    font-size: 0.85em;
    font-weight: 500;
    background-color: #e7f3ff;
    color: #2271b1;
    border-radius: 3px;
}

/* Bulk Actions Styling */
.tablenav .actions select {
    margin-right: 6px;
}

.tablenav .bulkactions {
    padding: 0;
}

/* Transfer Modal */
.wclp-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.wclp-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px 30px;
    border-radius: 4px;
    width: 500px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.wclp-modal-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.wclp-modal-close:hover {
    color: #000;
}

.wclp-modal h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.wclp-modal .form-table th {
    padding: 15px 10px 15px 0;
    width: 120px;
}

.wclp-modal .submit {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-bottom: 0;
}

/* Dashboard Styles */
.wclp-dashboard-stats {
    margin-top: 20px;
}

.wclp-stat-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.wclp-stat-card {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wclp-stat-icon {
    font-size: 32px;
    line-height: 1;
}

.wclp-stat-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.wclp-stat-content {
    display: flex;
    flex-direction: column;
}

.wclp-stat-number {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.wclp-stat-label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wclp-stat-total .wclp-stat-icon .dashicons {
    color: #2271b1;
}

.wclp-stat-active .wclp-stat-icon .dashicons {
    color: #00a32a;
}

.wclp-stat-inactive .wclp-stat-icon .dashicons {
    color: #dba617;
}

.wclp-stat-expired .wclp-stat-icon .dashicons {
    color: #d63638;
}

.wclp-stat-revoked .wclp-stat-icon .dashicons {
    color: #646970;
}

.wclp-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.wclp-stat-box {
    flex: 1;
    min-width: 280px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px 20px;
}

.wclp-stat-box.wclp-stat-full {
    flex: 100%;
    min-width: 100%;
}

.wclp-stat-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.wclp-stat-box .widefat {
    border: none;
}

.wclp-stat-value {
    text-align: right;
    font-weight: 600;
}

.wclp-stat-value.wclp-warning {
    color: #d63638;
}

/* Dashboard Bar Chart */
.wclp-chart-container {
    overflow-x: auto;
}

.wclp-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 200px;
    padding: 20px 0;
}

.wclp-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 50px;
}

.wclp-bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, #2271b1, #135e96);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    position: relative;
    transition: background 0.2s;
}

.wclp-bar:hover {
    background: linear-gradient(180deg, #135e96, #0a4b78);
}

.wclp-bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #1d2327;
}

.wclp-bar-label {
    margin-top: 8px;
    font-size: 10px;
    color: #646970;
    text-align: center;
    white-space: nowrap;
}

/* Dashboard Actions */
.wclp-dashboard-actions {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px 20px;
    margin-top: 20px;
}

.wclp-dashboard-actions h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

.wclp-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wclp-action-buttons .button .dashicons {
    vertical-align: middle;
    margin-right: 5px;
    margin-top: -2px;
}

/* Wider actions column for transfer link */
.licenses-table .license-actions {
    width: 220px;
}

/* Live Search Styles */
.wclp-live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 400px;
    max-width: 600px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.wclp-live-search-results:empty {
    display: none;
}

.wclp-search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.wclp-search-result-item:last-child {
    border-bottom: none;
}

.wclp-search-result-item:hover,
.wclp-search-result-item.active {
    background-color: #f0f6fc;
}

.wclp-result-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.wclp-result-key code {
    font-size: 13px;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}

.wclp-result-key mark {
    background-color: #fff8c5;
    padding: 0;
}

.wclp-result-details {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #646970;
    margin-bottom: 2px;
}

.wclp-result-domain mark {
    background-color: #fff8c5;
    padding: 0;
}

.wclp-result-product {
    color: #2271b1;
}

.wclp-result-customer {
    font-size: 11px;
    color: #8c8f94;
}

.wclp-result-customer small {
    opacity: 0.8;
}

.wclp-search-loading,
.wclp-search-no-results,
.wclp-search-error {
    padding: 15px;
    text-align: center;
    color: #646970;
    font-size: 13px;
}

.wclp-search-loading .spinner {
    float: none;
    margin: 0 5px 0 0;
    vertical-align: middle;
}

.wclp-search-error {
    color: #d63638;
}

/* Search box positioning */
.wclp-filter-form .search-box {
    position: relative;
}

#license-search-input {
    width: 280px;
}

/* Inline Editing Styles */
.wclp-editable-cell {
    position: relative;
}

.wclp-editable-cell .wclp-display-value {
    display: inline;
}

.wclp-editable-cell .wclp-edit-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
    color: #2271b1;
    padding: 0;
    margin-left: 5px;
    vertical-align: middle;
}

.wclp-editable-cell:hover .wclp-edit-btn {
    opacity: 1;
}

.wclp-editable-cell .wclp-edit-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.wclp-editable-cell .wclp-edit-btn:hover {
    color: #135e96;
}

.wclp-edit-form {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.wclp-edit-form .wclp-edit-input {
    max-width: 150px;
    height: 28px;
    padding: 0 8px;
}

.wclp-edit-form .wclp-edit-input[type="date"] {
    max-width: 130px;
}

.wclp-edit-form select.wclp-edit-input {
    max-width: 120px;
}

.wclp-edit-form .button-small {
    height: 26px;
    line-height: 24px;
    padding: 0 8px;
    font-size: 11px;
}

.wclp-edit-form .wclp-lifetime-btn {
    font-size: 16px;
    padding: 0 6px;
}

/* Inline notice animation */
.wclp-inline-notice {
    margin: 10px 0;
}

/* Make editable cells have a minimum height for consistency */
.licenses-table .wclp-editable-cell {
    min-width: 120px;
}

/* Domain column wider for edit form */
.licenses-table td[data-field="domain"] {
    min-width: 180px;
}

/* Status column */
.licenses-table td[data-field="status"] {
    min-width: 150px;
}

/* Expiry column */
.licenses-table td[data-field="expiry"] {
    min-width: 200px;
}

/* Copy License Key Button */
.wclp-copy-btn {
    color: #2271b1;
    padding: 0;
    margin-left: 5px;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
}

.wclp-copy-btn:hover {
    color: #135e96;
}

.wclp-copy-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.wclp-copy-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1d2327;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 5px;
}

.wclp-copy-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1d2327;
}

.wclp-license-key {
    user-select: all;
}
