/**
 * WebMinds UTM Platform - Elementor Frontend Styles
 *
 * @package WebMinds_UTM_Elementor
 * @version 2.0.0
 */

/* ============================================
   Widget Container Base Styles
   ============================================ */

.wm-utm-widget {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 30px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.wm-widget-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f1;
    padding-bottom: 20px;
}

.wm-widget-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
    color: #1e1e1e;
}

.wm-widget-description {
    margin: 0;
    color: #646970;
    font-size: 15px;
    line-height: 1.6;
}

/* ============================================
   Form Styles
   ============================================ */

.wm-form-group {
    margin-bottom: 24px;
}

.wm-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e1e1e;
    font-size: 14px;
}

.wm-form-group .required {
    color: #d63638;
    font-weight: bold;
}

.wm-form-group .wm-optional {
    color: #8c8f94;
    font-weight: normal;
    font-size: 13px;
}

.wm-field-description {
    margin: 8px 0 0 0;
    color: #646970;
    font-size: 13px;
    line-height: 1.5;
}

/* Form Inputs */
.wm-input,
.wm-select,
.wm-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #1e1e1e;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wm-input:focus,
.wm-select:focus,
.wm-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wm-input-small {
    max-width: 80px;
}

.wm-textarea {
    resize: vertical;
    font-family: 'Courier New', Courier, monospace;
}

/* Checkbox Labels */
.wm-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.wm-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wm-checkbox-label span {
    color: #1e1e1e;
    font-size: 14px;
}

/* Form Rows */
.wm-form-row {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}

.wm-form-row-2col {
    grid-template-columns: repeat(2, 1fr);
}

.wm-form-group-full {
    grid-column: 1 / -1;
}

/* ============================================
   Buttons
   ============================================ */

.wm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
}

.wm-btn-primary {
    background: #2271b1;
    color: #ffffff;
}

.wm-btn-primary:hover {
    background: #135e96;
}

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

.wm-btn-secondary {
    background: #f0f0f1;
    color: #1e1e1e;
}

.wm-btn-secondary:hover {
    background: #dcdcde;
}

.wm-btn-danger {
    background: #d63638;
    color: #ffffff;
}

.wm-btn-danger:hover {
    background: #b32d2e;
}

.wm-btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.wm-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

/* Button Loader */
.wm-btn-loader .wm-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wm-spin 0.8s linear infinite;
}

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

/* ============================================
   Messages & Alerts
   ============================================ */

.wm-message {
    padding: 14px 18px;
    border-radius: 4px;
    margin-top: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.wm-message.success {
    background: #d7f0d0;
    border-left: 4px solid #46b450;
    color: #1e4620;
}

.wm-message.error {
    background: #fce8e8;
    border-left: 4px solid #d63638;
    color: #5d1d1f;
}

.wm-message.warning {
    background: #fcf3cd;
    border-left: 4px solid #dba617;
    color: #614200;
}

/* ============================================
   URL Preview
   ============================================ */

.wm-url-preview {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.wm-url-preview h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #646970;
}

.wm-preview-url {
    background: #ffffff;
    padding: 12px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    word-break: break-all;
    margin-bottom: 12px;
    color: #2271b1;
}

.wm-copy-url {
    margin-top: 8px;
}

/* ============================================
   Repository Search
   ============================================ */

.wm-repository-search {
    margin-bottom: 24px;
}

.wm-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 15px;
    background: #f6f7f7;
}

.wm-search-input:focus {
    outline: none;
    border-color: #2271b1;
    background: #ffffff;
}

/* ============================================
   Link Repository List
   ============================================ */

.wm-repository-list,
.wm-reports-list {
    display: grid;
    gap: 16px;
}

.wm-link-item,
.wm-report-item {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 20px;
    transition: box-shadow 0.2s ease;
}

.wm-link-item:hover,
.wm-report-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.wm-link-header,
.wm-report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.wm-link-campaign,
.wm-report-campaign {
    font-size: 18px;
    font-weight: 600;
    color: #1e1e1e;
    margin: 0;
}

.wm-link-actions,
.wm-report-actions {
    display: flex;
    gap: 8px;
}

.wm-link-meta,
.wm-report-meta {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.wm-meta-row {
    display: flex;
    font-size: 13px;
}

.wm-meta-label {
    font-weight: 600;
    color: #646970;
    min-width: 100px;
}

.wm-meta-value {
    color: #1e1e1e;
    word-break: break-all;
}

.wm-meta-value code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* Validation Status */
.wm-validation-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.wm-validation-status.success {
    background: #d7f0d0;
    color: #1e4620;
}

.wm-validation-status.error {
    background: #fce8e8;
    color: #5d1d1f;
}

/* ============================================
   Audit Results
   ============================================ */

.wm-audit-results {
    margin-top: 30px;
}

.wm-audit-results h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
}

.wm-audit-results-content {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 20px;
}

.wm-audit-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
    border-radius: 4px;
}

.wm-audit-check:last-child {
    margin-bottom: 0;
}

.wm-audit-icon {
    font-size: 20px;
    line-height: 1;
}

.wm-audit-icon.success {
    color: #46b450;
}

.wm-audit-icon.error {
    color: #d63638;
}

.wm-audit-icon.warning {
    color: #dba617;
}

.wm-audit-content h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
}

.wm-audit-content p {
    margin: 0;
    font-size: 13px;
    color: #646970;
}

/* ============================================
   Loading & Empty States
   ============================================ */

.wm-loading-state,
.wm-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.wm-loading-state .wm-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wm-spin 0.8s linear infinite;
}

.wm-loading-state p,
.wm-empty-state p {
    margin: 16px 0 0 0;
    color: #646970;
    font-size: 15px;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 782px) {
    .wm-utm-widget {
        padding: 20px;
    }

    .wm-widget-header h2 {
        font-size: 24px;
    }

    .wm-form-row-2col {
        grid-template-columns: 1fr;
    }

    .wm-link-header,
    .wm-report-header {
        flex-direction: column;
        gap: 12px;
    }

    .wm-form-actions {
        flex-direction: column;
    }

    .wm-btn {
        width: 100%;
    }
}

/* ============================================
   Editor Preview Styles
   ============================================ */

.wm-editor-preview {
    background: #f6f7f7;
    border: 2px dashed #dcdcde;
    border-radius: 4px;
    padding: 40px;
    text-align: center;
    color: #646970;
    font-style: italic;
}

/* ============================================
   Utility Classes
   ============================================ */

.wm-text-center {
    text-align: center;
}

.wm-mt-20 {
    margin-top: 20px;
}

.wm-mb-20 {
    margin-bottom: 20px;
}

.wm-hidden {
    display: none !important;
}
