/* Codeon License Manager V2 - Frontend Styles (Unique: v2.0.0) */
/* Namespace: .codeon-license-v2-frontend */
/* Specificity: WooCommerce Account Pages */

/* High specificity container to prevent theme conflicts */
.woocommerce-account .codeon-license-v2-frontend,
.woocommerce-account [class*="codeon-license-v2"],
.woocommerce [class*="codeon-"] {
    /* Base reset for our components */
    box-sizing: border-box;
}

/* License Table in My Account */
.woocommerce-account .woocommerce-table--order-details.codeon-licenses-table {
    margin-top: 20px;
}

.codeon-licenses-table th,
.codeon-licenses-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
}

.codeon-licenses-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.codeon-licenses-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* License Status Badges */
.license-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.license-status-inactive {
    background-color: #e2e3e5;
    color: #495057;
}

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

/* License Key Styling */
.codeon-license-key {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    background: #f6f7f7;
    padding: 4px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    word-break: break-all;
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
}

.codeon-license-key:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.codeon-license-key.expanded {
    max-width: none;
    white-space: normal;
    word-break: break-all;
}

/* Copy Button */
.codeon-copy-button {
    background: #007cba;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    cursor: pointer;
    margin-left: 5px;
    transition: background-color 0.2s;
}

.codeon-copy-button:hover {
    background: #005a87;
}

.codeon-copy-button.copied {
    background: #28a745;
}

/* Expiry Date Styling */
.codeon-expiry-date {
    font-weight: 500;
}

.codeon-expiry-warning {
    color: #dc3545;
    font-weight: bold;
}

.codeon-expiry-critical {
    color: #dc3545;
    font-weight: bold;
    animation: codeon-blink 1s infinite;
}

@keyframes codeon-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

/* Usage Progress */
.codeon-usage-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.codeon-usage-bar {
    flex: 1;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.codeon-usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #28a745 70%, #ffc107 70%, #ffc107 90%, #dc3545 90%);
    transition: width 0.3s ease;
}

.codeon-usage-text {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .codeon-licenses-table {
        font-size: 14px;
    }
    
    .codeon-licenses-table th,
    .codeon-licenses-table td {
        padding: 8px;
    }
    
    .codeon-license-key {
        font-size: 11px;
        max-width: 150px;
    }
    
    .codeon-usage-progress {
        min-width: 80px;
    }
}

@media (max-width: 600px) {
    /* Stack table on mobile */
    .codeon-licenses-table,
    .codeon-licenses-table thead,
    .codeon-licenses-table tbody,
    .codeon-licenses-table th,
    .codeon-licenses-table td,
    .codeon-licenses-table tr {
        display: block;
    }
    
    .codeon-licenses-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .codeon-licenses-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 4px;
        background: #fff;
    }
    
    .codeon-licenses-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50% !important;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    
    .codeon-licenses-table td:before {
        content: attr(data-title) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: #333;
    }
    
    .codeon-license-key {
        max-width: none;
        font-size: 10px;
    }
}

/* License Actions */
.codeon-license-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.codeon-license-action {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #007cba;
    background: transparent;
    color: #007cba;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.codeon-license-action:hover {
    background: #007cba;
    color: white;
    text-decoration: none;
}

.codeon-license-action.danger {
    border-color: #dc3545;
    color: #dc3545;
}

.codeon-license-action.danger:hover {
    background: #dc3545;
    color: white;
}

/* Loading States */
.codeon-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: codeon-spin 1s linear infinite;
    margin-right: 5px;
}

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

/* Empty State */
.codeon-no-licenses {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

.codeon-no-licenses .icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Tooltips */
.codeon-tooltip {
    position: relative;
    cursor: help;
}

.codeon-tooltip:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

.codeon-tooltip:hover:before {
    content: '';
    position: absolute;
    bottom: 118%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

/* Notifications */
.codeon-notice {
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
}

.codeon-notice.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.codeon-notice.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.codeon-notice.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.codeon-notice.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Animation Classes */
.codeon-fade-in {
    animation: codeonFadeIn 0.3s ease-in-out;
}

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

.codeon-slide-in {
    animation: codeonSlideIn 0.3s ease-out;
}

@keyframes codeonSlideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .codeon-licenses-table th {
        background-color: #2d3748;
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .codeon-licenses-table td {
        border-bottom-color: #4a5568;
    }
    
    .codeon-licenses-table tbody tr:hover {
        background-color: #2d3748;
    }
    
    .codeon-license-key {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .codeon-license-key:hover {
        background: #4a5568;
        border-color: #718096;
    }
    
    .codeon-usage-bar {
        background-color: #4a5568;
    }
    
    .codeon-usage-text {
        color: #a0aec0;
    }
}

/* Print Styles */
@media print {
    .codeon-license-actions,
    .codeon-copy-button {
        display: none;
    }
    
    .codeon-licenses-table {
        border-collapse: collapse;
    }
    
    .codeon-licenses-table th,
    .codeon-licenses-table td {
        border: 1px solid #000;
        padding: 5px;
    }
    
    .codeon-license-key {
        background: transparent;
        border: 1px solid #000;
        font-size: 10px;
        max-width: none;
        white-space: normal;
        word-break: break-all;
    }
}

/* Accessibility Improvements */
.codeon-license-key:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.codeon-copy-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.codeon-license-action:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Screen Reader Only */
.codeon-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
