/**
 * WC License Manager - Frontend Styles
 */

/* My Licenses Page */
.wclm-my-licenses {
    max-width: 100%;
}

.wclm-my-licenses h3 {
    margin-bottom: 20px;
}

.wclm-no-licenses {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.wclm-no-licenses .button {
    margin-top: 15px;
}

/* License Cards */
.wclm-licenses-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wclm-license-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wclm-license-card.wclm-license-inactive {
    opacity: 0.7;
}

.wclm-license-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e4e7;
}

.wclm-license-product {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wclm-product-image img {
    border-radius: 4px;
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.wclm-product-info h4 {
    margin: 0 0 5px;
    font-size: 16px;
}

.wclm-order-link {
    font-size: 13px;
    color: #666;
}

.wclm-order-link a {
    color: #0073aa;
    text-decoration: none;
}

.wclm-order-link a:hover {
    text-decoration: underline;
}

/* Status */
.wclm-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.wclm-status-expired {
    background: #fff3cd;
    color: #856404;
}

.wclm-status-revoked {
    background: #f8d7da;
    color: #721c24;
}

/* License Body */
.wclm-license-body {
    padding: 20px;
}

.wclm-license-key-row {
    margin-bottom: 20px;
}

.wclm-license-key-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.wclm-license-key-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wclm-license-key {
    font-family: 'Courier New', Courier, monospace;
    background: #f5f5f5;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 15px;
    letter-spacing: 1px;
    border: 1px solid #ddd;
    user-select: all;
}

.wclm-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.wclm-copy-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.wclm-copy-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.wclm-copy-btn.copied {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* License Details */
.wclm-license-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 20px;
}

.wclm-detail label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.wclm-detail span {
    font-size: 14px;
    color: #333;
}

.wclm-remaining {
    font-size: 12px;
    color: #666;
}

.wclm-expired {
    color: #dc3545 !important;
}

/* Activations Table */
.wclm-activations {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e4e7;
}

.wclm-activations h5 {
    margin: 0 0 15px;
    font-size: 14px;
    font-weight: 600;
}

.wclm-activations-table {
    width: 100%;
    border-collapse: collapse;
}

.wclm-activations-table th,
.wclm-activations-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e2e4e7;
}

.wclm-activations-table th {
    background: #f8f9fa;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    font-weight: 600;
}

.wclm-device-name {
    display: block;
    font-weight: 500;
}

.wclm-device-id {
    display: block;
    font-size: 11px;
    color: #888;
    font-family: 'Courier New', Courier, monospace;
}

.wclm-deactivate-btn {
    font-size: 12px;
    padding: 5px 10px;
}

/* Order License Display - Thank You Page & Order Details */
.woocommerce-order-details + .woocommerce-order-licenses,
.woocommerce-table + h2 + .woocommerce-table.license_keys,
section.woocommerce-order-details ~ h2,
.woocommerce-order h2.wclm-licenses-title {
    margin-top: 30px;
}

h2.wclm-licenses-title,
.woocommerce-order-details ~ h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    color: #333;
}

.woocommerce-table.shop_table.license_keys,
.woocommerce-table.license_keys,
table.wclm-order-licenses-table {
    width: 100%;
    margin-top: 15px;
    margin-bottom: 30px;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.woocommerce-table.license_keys thead,
table.wclm-order-licenses-table thead {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
}

.woocommerce-table.license_keys thead th,
table.wclm-order-licenses-table thead th {
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 15px;
    text-align: left;
    border: none;
}

.woocommerce-table.license_keys tbody tr,
table.wclm-order-licenses-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.woocommerce-table.license_keys tbody tr:hover,
table.wclm-order-licenses-table tbody tr:hover {
    background-color: #f8fafc;
}

.woocommerce-table.license_keys tbody tr:last-child,
table.wclm-order-licenses-table tbody tr:last-child {
    border-bottom: none;
}

.woocommerce-table.license_keys td,
table.wclm-order-licenses-table td {
    padding: 15px;
    vertical-align: middle;
    border: none;
}

.woocommerce-table.license_keys code,
table.wclm-order-licenses-table code {
    display: inline-block;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    padding: 10px 15px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 1px;
    border: 1px solid #d0d5dd;
    user-select: all;
    cursor: text;
}

.woocommerce-table.license_keys code:hover,
table.wclm-order-licenses-table code:hover {
    background: linear-gradient(135deg, #e8ecf0 0%, #d8dce0 100%);
    border-color: #0073aa;
}

/* Status badges in order table */
.wclm-status-badge,
.woocommerce-table.license_keys .wclm-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wclm-status-badge.active,
.woocommerce-table.license_keys .wclm-status-active {
    background: #d4edda;
    color: #155724;
}

/* Activation info in order table */
.wclm-activation-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wclm-activation-count {
    font-weight: 600;
    color: #333;
}

.wclm-activation-max {
    color: #666;
    font-size: 13px;
}

/* License info section on order page */
.wclm-order-license-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.wclm-order-license-info h3 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #333;
}

.wclm-order-license-info p {
    margin: 8px 0;
    color: #555;
    font-size: 14px;
}

.wclm-order-license-info .wclm-license-key-display {
    margin-top: 15px;
}

/* License key card style for order confirmation */
.wclm-license-card-order {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.wclm-license-card-order .product-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.wclm-license-card-order .license-key-wrapper {
    background: #f5f7fa;
    border: 1px dashed #ccc;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    margin: 10px 0;
}

.wclm-license-card-order .license-key-wrapper code {
    font-size: 18px;
    letter-spacing: 2px;
    color: #0073aa;
    background: transparent;
    border: none;
    padding: 0;
}

.wclm-license-card-order .license-meta {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #666;
}

.wclm-license-card-order .license-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wclm-license-card-order .license-meta strong {
    color: #333;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .wclm-license-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .wclm-license-status {
        align-self: flex-start;
    }
    
    .wclm-license-key-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wclm-license-key {
        font-size: 13px;
        word-break: break-all;
    }
    
    .wclm-license-details {
        grid-template-columns: 1fr;
    }
    
    .wclm-activations-table {
        font-size: 13px;
    }
    
    .wclm-activations-table th,
    .wclm-activations-table td {
        padding: 8px 5px;
    }
}

/* Loading State */
.wclm-loading {
    opacity: 0.5;
    pointer-events: none;
}

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

@keyframes wclm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.wclm-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #333;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    z-index: 9999;
    animation: wclm-fadeIn 0.3s ease;
}

.wclm-toast.success {
    background: #155724;
}

.wclm-toast.error {
    background: #721c24;
}

@keyframes wclm-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
