/* SSI Licence Tools — Frontend Styles */

/* ── Reset & Container ──────────────────────────────────────────────────────── */
.ltm-wrap,
.ltm-wrap *,
.ltm-wrap *::before,
.ltm-wrap *::after {
    box-sizing: border-box;
}

.ltm-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 24px 28px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a2e;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.ltm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 24px;
}

.ltm-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    text-align: center;
}

.ltm-tab:hover {
    color: #16213e;
}

.ltm-tab.active {
    color: #16213e;
    border-bottom-color: #16213e;
}

/* ── Panels ─────────────────────────────────────────────────────────────────── */
.ltm-panel {
    display: none;
}

.ltm-panel.active {
    display: block;
}

/* ── Form Fields ────────────────────────────────────────────────────────────── */
.ltm-form {
    width: 100%;
}

.ltm-field {
    margin-bottom: 20px;
}

.ltm-field label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.ltm-req {
    color: #dc3545;
    font-weight: 700;
}

.ltm-field input[type="text"],
.ltm-field input[type="url"],
.ltm-field select,
.ltm-field textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.ltm-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.ltm-field textarea {
    resize: vertical;
    min-height: 80px;
    font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
    font-size: 13px;
}

.ltm-field input:focus,
.ltm-field select:focus,
.ltm-field textarea:focus {
    outline: none;
    border-color: #1a1a2e;
    box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.08);
}

.ltm-field input::placeholder,
.ltm-field textarea::placeholder {
    color: #adb5bd;
}

.ltm-hint {
    display: block;
    margin-top: 4px;
    font-size: 12.5px;
    color: #888;
    line-height: 1.4;
}

/* ── Button ─────────────────────────────────────────────────────────────────── */
/* Button uses default WordPress/theme styling */

.ltm-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.ltm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.ltm-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ltm-spin 0.6s linear infinite;
}

.ltm-btn.loading .ltm-spinner {
    display: inline-block;
}

.ltm-btn.loading .ltm-btn-text {
    opacity: 0.7;
}

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

/* ── Result ─────────────────────────────────────────────────────────────────── */
.ltm-result {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
    word-break: break-word;
    line-height: 1.5;
}

.ltm-result.success {
    display: block;
    background: #edf7ed;
    border: 1px solid #c3e6c3;
    border-left: 4px solid #4caf50;
    color: #256029;
}

.ltm-result.error {
    display: block;
    background: #fdecea;
    border: 1px solid #f5c6c6;
    border-left: 4px solid #d32f2f;
    color: #611a15;
}

.ltm-result .ltm-result-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.ltm-result-row {
    display: flex;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 8px;
}

.ltm-result-label {
    font-weight: 600;
    white-space: nowrap;
    min-width: 110px;
}

.ltm-result-value {
    word-break: break-all;
    font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
    font-size: 12.5px;
}

.ltm-result-token {
    display: block;
    margin-top: 6px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
    font-size: 11.5px;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.6;
    user-select: all;
}

.ltm-result-valid {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 13px;
}

.ltm-result-valid.valid-true {
    background: #c3e6c3;
    color: #256029;
}

.ltm-result-valid.valid-false {
    background: #f5c6c6;
    color: #b71c1c;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ltm-wrap {
        padding: 16px 14px;
    }

    .ltm-tab {
        font-size: 13px;
        padding: 10px 8px;
    }

    .ltm-field label {
        font-size: 13px;
    }

    .ltm-field input[type="text"],
    .ltm-field select,
    .ltm-field textarea {
        font-size: 14px;
        padding: 9px 12px;
    }

    .ltm-result-row {
        flex-direction: column;
        gap: 2px;
    }

    .ltm-result-label {
        min-width: auto;
    }
}

/* ── Elementor full-width fix ───────────────────────────────────────────────── */
.elementor-widget-shortcode .ltm-wrap,
.elementor-widget-text-editor .ltm-wrap,
.elementor-element .ltm-wrap {
    width: 100% !important;
    max-width: 100% !important;
}
