/**
 * CM License Engine - Frontend Styles
 * Uses --cmc-theme-* CSS variables from Core
 */

/* =========================================================================
   Theme Variables
   ========================================================================= */
:root {
    --cmle-fe-primary: var(--cmc-theme-primary-color, #5bc0de);
    --cmle-fe-primary-hover: var(--cmc-theme-primary-hover-color, #46b8da);
    --cmle-fe-success: var(--cmc-theme-success-color, #5cb85c);
    --cmle-fe-success-hover: #4cae4c;
    --cmle-fe-error: var(--cmc-theme-error-color, #d9534f);
    --cmle-fe-warning: var(--cmc-theme-warning-color, #f0ad4e);
    --cmle-fe-border: var(--cmc-theme-border-color, #ddd);
    --cmle-fe-border-subtle: #eee;
    --cmle-fe-text: var(--cmc-theme-text-color, #292b2c);
    --cmle-fe-text-muted: var(--cmc-theme-text-muted-color, #777);
    --cmle-fe-bg: var(--cmc-theme-background-color, #fff);
    --cmle-fe-bg-subtle: #f9f9f9;
    --cmle-fe-bg-header: #f5f5f5;
    --cmle-fe-radius: var(--cmc-theme-border-radius, 3px);
    --cmle-fe-disabled-bg: #ccc;

    /* Status badge colors */
    --cmle-fe-status-pending-bg: var(--cmle-fe-warning);
    --cmle-fe-status-active-bg: var(--cmle-fe-success);
    --cmle-fe-status-expired-bg: var(--cmle-fe-error);
    --cmle-fe-status-blocked-bg: var(--cmle-fe-text);

    /* Message colors */
    --cmle-fe-msg-success-bg: #dff0d8;
    --cmle-fe-msg-success-border: #d6e9c6;
    --cmle-fe-msg-success-color: #3c763d;
    --cmle-fe-msg-error-bg: #f2dede;
    --cmle-fe-msg-error-border: #ebccd1;
    --cmle-fe-msg-error-color: #a94442;
}

/* Licenses Section (standalone page, not used inside accordion) */
.cmle-licenses-section {
    max-width: 800px;
    margin: 0 auto;
}

.cmle-licenses-section h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--cmle-fe-border-subtle);
}

/* Register License subsection (inside accordion, styled by cmuk-content-section) */
.cmle-register-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* License list subsection (inside accordion, styled by cmuk-content-section) */
.cmle-license-list-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* Form Styles */
.cmle-form {
    margin: 0;
}

.cmle-form-group {
    margin-bottom: 15px;
}

.cmle-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
    font-size: 14px;
}

.cmle-form-group label.cmle-form-label {
    font-weight: normal;
}

.cmle-input {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cmle-fe-border);
    border-radius: var(--cmle-fe-radius);
    font-size: 14px;
    box-sizing: border-box;
}

.cmle-input:focus {
    border-color: var(--cmle-fe-primary);
    outline: none;
    box-shadow: 0 0 3px rgba(91, 192, 222, 0.3);
}

/* Button Styles */
.cmle-button {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--cmle-fe-radius);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.cmle-button-primary {
    background: var(--cmle-fe-primary);
    color: var(--cmle-fe-bg);
}

.cmle-button-primary:hover {
    background: var(--cmle-fe-primary-hover);
}

.cmle-button-start {
    background: var(--cmle-fe-success);
    color: var(--cmle-fe-bg);
    padding: 8px 16px;
}

.cmle-button-start:hover {
    background: var(--cmle-fe-success-hover);
}

.cmle-button:disabled {
    background: var(--cmle-fe-disabled-bg);
    cursor: not-allowed;
}

/* Messages — empty by default, styled only when populated via JS */
.cmle-message:empty {
    display: none;
}

.cmle-message.success,
.cmle-message.error {
    padding: 12px 15px;
    margin-top: 15px;
    border-radius: var(--cmle-fe-radius);
}

.cmle-message.success {
    background: var(--cmle-fe-msg-success-bg);
    border: 1px solid var(--cmle-fe-msg-success-border);
    color: var(--cmle-fe-msg-success-color);
}

.cmle-message.error {
    background: var(--cmle-fe-msg-error-bg);
    border: 1px solid var(--cmle-fe-msg-error-border);
    color: var(--cmle-fe-msg-error-color);
}

.cmle-no-licenses {
    color: var(--cmle-fe-text-muted);
    font-style: italic;
}

/* Table Styles */
.cmle-licenses-table-wrapper {
    overflow-x: auto;
}

.cmle-licenses-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.cmle-licenses-table th,
.cmle-licenses-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--cmle-fe-border-subtle);
}

.cmle-licenses-table th {
    background: var(--cmle-fe-bg-header);
    font-weight: bold;
}

.cmle-licenses-table tr:hover {
    background: var(--cmle-fe-bg-subtle);
}

.cmle-license-key {
    font-family: monospace;
    font-size: 12px;
}

/* Status Badges */
.cmle-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--cmle-fe-radius);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.cmle-status-pending {
    background: var(--cmle-fe-status-pending-bg);
    color: var(--cmle-fe-bg);
}

.cmle-status-active {
    background: var(--cmle-fe-status-active-bg);
    color: var(--cmle-fe-bg);
}

.cmle-status-expired {
    background: var(--cmle-fe-status-expired-bg);
    color: var(--cmle-fe-bg);
}

.cmle-status-blocked {
    background: var(--cmle-fe-status-blocked-bg);
    color: var(--cmle-fe-bg);
}

.cmle-active-badge,
.cmle-expired-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--cmle-fe-radius);
    font-size: 11px;
    font-weight: bold;
}

.cmle-active-badge {
    background: var(--cmle-fe-success);
    color: var(--cmle-fe-bg);
}

.cmle-expired-badge {
    background: var(--cmle-fe-error);
    color: var(--cmle-fe-bg);
}

/* Pending expiry (shows expected duration from generator) */
.cmle-pending-expiry {
    color: var(--cmle-fe-text-muted);
    font-style: italic;
}

/* Expired date */
.cmle-expired {
    color: var(--cmle-fe-error);
}

/* License key display */
.cmle-key-display {
    font-size: 12px;
    word-break: break-all;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .cmle-licenses-table {
        font-size: 12px;
    }

    .cmle-licenses-table th,
    .cmle-licenses-table td {
        padding: 8px;
    }

    .cmle-button {
        padding: 8px 16px;
        font-size: 13px;
    }
}
