/**
 * Click to Chat - Unified Admin CSS
 * Single consistent design system for all admin pages
 */

/* ============================================
   BASE LAYOUT
   ============================================ */

.ctc-chat-admin-container {
    max-width: 1200px;
    margin: 20px auto;
}

.ctc-chat-admin-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.ctc-chat-admin-logo {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    font-size: 32px;
}

.ctc-chat-admin-heading {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

/* ============================================
   INSTRUCTIONS BANNER
   ============================================ */

.ctc-chat-instructions-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 8px;
    margin: 20px 0;
}

.ctc-chat-instructions-banner h2 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctc-chat-instructions-banner h2 .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.ctc-chat-instructions-banner p {
    color: rgba(255,255,255,0.95);
    margin: 0 0 15px 0;
}

.ctc-chat-quick-steps {
    display: flex;
    gap: 30px;
    margin-top: 15px;
}

.ctc-chat-step {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctc-chat-step-number {
    background: rgba(255,255,255,0.2);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
}

.ctc-chat-step span:last-child {
    color: rgba(255,255,255,0.95);
    font-size: 14px;
}

/* ============================================
   WARNING BOX
   ============================================ */

.ctc-chat-admin-warning-box {
    background: #fff8e5;
    border-left: 4px solid #f0ad4e;
    padding: 15px 20px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ctc-chat-warning-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.ctc-chat-warning-item:last-child {
    margin-bottom: 0;
}

.ctc-chat-warning-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.ctc-chat-warning-content {
    flex: 1;
    color: #856404;
    font-size: 14px;
    line-height: 1.6;
}

.ctc-chat-warning-content strong {
    color: #856404;
    font-weight: 600;
}

.ctc-chat-warning-content a {
    color: #d9534f;
    text-decoration: none;
    font-weight: 500;
}

.ctc-chat-warning-content a:hover {
    text-decoration: underline;
}

/* ============================================
   CARD SYSTEM (Numbers, Templates, etc.)
   ============================================ */

.ctc-chat-number-card,
.ctc-chat-template-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.ctc-chat-number-card:hover,
.ctc-chat-template-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ctc-chat-number-header,
.ctc-chat-template-header {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctc-chat-number-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ctc-chat-number-icon,
.ctc-chat-template-icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #25D366;
}

.ctc-chat-number-title,
.ctc-chat-template-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ctc-chat-number-actions {
    display: flex;
    gap: 10px;
}

.ctc-chat-number-toggle,
.ctc-chat-number-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 5px;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
}

.ctc-chat-number-toggle:hover {
    color: #25D366;
}

.ctc-chat-number-delete:hover {
    color: #dc3232;
}

.ctc-chat-number-actions .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ctc-chat-number-body,
.ctc-chat-template-body {
    padding: 20px;
    display: block;
}

.ctc-chat-number-card.collapsed .ctc-chat-number-body {
    display: none;
}

.ctc-chat-number-card.collapsed .ctc-chat-number-toggle .dashicons:before {
    content: "\f140";
}

/* ============================================
   FORM FIELDS SYSTEM
   ============================================ */

.ctc-chat-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.ctc-chat-field-group {
    margin-bottom: 20px;
}

.ctc-chat-field-group.ctc-chat-full-width {
    grid-column: span 2;
}

.ctc-chat-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.ctc-chat-field-label .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
    color: #25D366;
}

.ctc-chat-input,
.ctc-chat-textarea,
.ctc-chat-field-group input[type="text"],
.ctc-chat-field-group input[type="number"],
.ctc-chat-field-group select,
.ctc-chat-field-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.ctc-chat-input:focus,
.ctc-chat-textarea:focus,
.ctc-chat-field-group input[type="text"]:focus,
.ctc-chat-field-group input[type="number"]:focus,
.ctc-chat-field-group select:focus,
.ctc-chat-field-group textarea:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.ctc-chat-textarea {
    resize: vertical;
    font-family: inherit;
    min-height: 80px;
}

.ctc-chat-field-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* ============================================
   CHECKBOX & RADIO OPTIONS
   ============================================ */

.ctc-chat-checkbox-option,
.ctc-chat-radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 8px;
}

.ctc-chat-checkbox-option input[type="checkbox"],
.ctc-chat-radio-option input[type="radio"] {
    margin: 0;
}

.ctc-chat-checkbox-option span,
.ctc-chat-radio-option span {
    font-weight: 500;
}

.ctc-chat-default-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

/* ============================================
   ASSIGNMENTS SECTION
   ============================================ */

.ctc-chat-assignments-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.ctc-chat-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.ctc-chat-section-title .dashicons {
    color: #25D366;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ctc-chat-assignments-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ============================================
   BUTTONS
   ============================================ */

.ctc-chat-add-number-section {
    margin: 20px 0;
    text-align: center;
}

.ctc-chat-add-btn {
    background: #25D366;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(37, 211, 102, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ctc-chat-add-btn:hover {
    background: #20bd5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.4);
}

.ctc-chat-add-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ctc-chat-preview-btn {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-size: 13px;
}

.ctc-chat-preview-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.ctc-chat-preview-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ============================================
   SAVE SECTION
   ============================================ */

.ctc-chat-save-section {
    margin: 40px 0 20px;
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.ctc-chat-save-btn,
.ctc-chat-btn {
    background: #25D366;
    color: white;
    border: none;
    padding: 12px 35px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ctc-chat-save-btn:hover,
.ctc-chat-btn:hover {
    background: #20bd5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.ctc-chat-save-btn .dashicons,
.ctc-chat-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

.ctc-chat-save-note {
    margin: 12px 0 0;
    color: #666;
    font-size: 13px;
}

/* ============================================
   TEMPLATES PAGE
   ============================================ */

.ctc-chat-templates-wrapper {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.ctc-chat-template-description {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 13px;
}

.ctc-chat-placeholders-section {
    margin-bottom: 20px;
}

.ctc-chat-placeholders-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ctc-chat-placeholder-tag {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #c8e6c9;
}

.ctc-chat-placeholder-tag:hover {
    background: #25D366;
    color: white;
    border-color: #25D366;
    transform: translateY(-1px);
}

.ctc-chat-template-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 150px;
    transition: border-color 0.2s;
}

.ctc-chat-template-textarea:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.ctc-chat-template-actions {
    display: flex;
    gap: 10px;
}

.ctc-chat-template-preview {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
}

.ctc-chat-template-preview.error {
    background: #ffebee;
    border-color: #ffcdd2;
    color: #c62828;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */

.ctc-chat-settings-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0;
}

.ctc-chat-settings-nav-item {
    background: transparent;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.ctc-chat-settings-nav-item:hover {
    color: #495057;
    background: #f8f9fa;
}

.ctc-chat-settings-nav-item.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: transparent;
}

.ctc-chat-settings-nav-item .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ctc-chat-settings-panel {
    display: none;
}

.ctc-chat-settings-panel.active {
    display: block;
}

.ctc-chat-form-group {
    margin-bottom: 20px;
}

.ctc-chat-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.ctc-chat-form-group input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

.ctc-chat-field-description {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    line-height: 1.5;
}

.ctc-chat-color-field {
    width: 100px !important;
}

/* ============================================
   SHORTCODE PAGE
   ============================================ */

.ctc-chat-builder-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ctc-chat-config-panel,
.ctc-chat-preview-panel {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.ctc-chat-panel-title {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 18px;
}

.ctc-chat-field-section {
    margin-bottom: 25px;
}

.ctc-chat-field-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.ctc-chat-button-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ctc-chat-type-card {
    display: block;
    cursor: pointer;
}

.ctc-chat-type-card input {
    display: none;
}

.ctc-chat-type-card-inner {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ctc-chat-type-card input:checked + .ctc-chat-type-card-inner {
    border-color: #25D366;
    background: #f0fff4;
}

.ctc-chat-type-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.ctc-chat-type-label {
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.ctc-chat-type-card small {
    font-size: 11px;
    color: #666;
}

.ctc-chat-color-fields,
.ctc-chat-size-align-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ctc-chat-product-id-field {
    margin-top: 10px;
    margin-left: 25px;
}

.ctc-chat-collapsible {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctc-chat-collapsible:hover {
    color: #25D366;
}

.ctc-chat-collapsible.active .dashicons {
    transform: rotate(90deg);
}

.ctc-chat-advanced-content {
    margin-top: 15px;
}

.ctc-chat-preview-section,
.ctc-chat-shortcode-section,
.ctc-chat-examples-section,
.ctc-chat-help-section {
    margin-bottom: 25px;
}

.ctc-chat-preview-section h3,
.ctc-chat-shortcode-section h3,
.ctc-chat-examples-section h3,
.ctc-chat-help-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ctc-chat-preview-area {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 6px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctc-chat-shortcode-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    gap: 10px;
}

.ctc-chat-shortcode-box code {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
}

.ctc-chat-copy-btn {
    background: #25D366;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.ctc-chat-copy-btn:hover {
    background: #20bd5a;
}

.ctc-chat-copy-success {
    margin-top: 8px;
    color: #25D366;
    font-weight: 500;
    font-size: 13px;
}

.ctc-chat-example-list {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.ctc-chat-example {
    margin-bottom: 10px;
    font-size: 13px;
}

.ctc-chat-example:last-child {
    margin-bottom: 0;
}

.ctc-chat-example code {
    background: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.ctc-chat-help-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.ctc-chat-help-list li {
    margin-bottom: 8px;
    font-size: 13px;
}

/* ============================================
   VISIBILITY HELPERS
   ============================================ */

.ctc-chat-template-preview.ctc-chat-hidden,
.ctc-chat-product-options.ctc-chat-hidden,
.ctc-chat-product-id-field.ctc-chat-hidden,
.ctc-chat-advanced-content.ctc-chat-hidden,
.ctc-chat-copy-success.ctc-chat-hidden,
.ctc-chat-cart-position-row.ctc-chat-hidden,
.ctc-chat-checkout-position-row.ctc-chat-hidden {
    display: none;
}

.ctc-chat-template-preview.ctc-chat-visible,
.ctc-chat-product-options.ctc-chat-visible,
.ctc-chat-product-id-field.ctc-chat-visible,
.ctc-chat-advanced-content.ctc-chat-visible,
.ctc-chat-copy-success.ctc-chat-visible {
    display: block;
}

/* ============================================
   SELECT2 OVERRIDES
   ============================================ */

.ctc-chat-page-select,
.ctc-chat-post-select,
.ctc-chat-category-select,
.ctc-chat-tag-select,
.ctc-chat-product-select,
.ctc-chat-number-card .select2-container {
    width: 100% !important;
}

.ctc-chat-number-card .select2-container--default .select2-selection--multiple {
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 38px;
}

.ctc-chat-number-card .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

/* ============================================
   CATALOG MODE
   ============================================ */

.ctc-chat-catalog-mode-active {
    position: relative;
    opacity: 0.6;
}

.ctc-chat-catalog-mode-active label {
    cursor: not-allowed;
    position: relative;
    padding-left: 25px;
}

.ctc-chat-catalog-mode-active label::before {
    content: '✓';
    position: absolute;
    left: 2px;
    top: 2px;
    color: #25D366;
    font-weight: bold;
    font-size: 14px;
    pointer-events: none;
    background: white;
    border: 1px solid #25D366;
    border-radius: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ctc-chat-catalog-mode-active input[type="checkbox"] {
    opacity: 0;
    cursor: not-allowed;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 900px) {
    .ctc-chat-quick-steps {
        flex-direction: column;
        gap: 10px;
    }

    .ctc-chat-fields-grid {
        grid-template-columns: 1fr;
    }

    .ctc-chat-field-group.ctc-chat-full-width {
        grid-column: span 1;
    }

    .ctc-chat-assignments-grid {
        grid-template-columns: 1fr;
    }

    .ctc-chat-settings-nav {
        flex-wrap: wrap;
    }

    .ctc-chat-form-group input[type="text"],
    .ctc-chat-form-group input[type="number"],
    .ctc-chat-form-group select,
    .ctc-chat-form-group textarea {
        max-width: 100%;
    }

    .ctc-chat-builder-wrapper {
        grid-template-columns: 1fr;
    }

    .ctc-chat-button-types {
        grid-template-columns: 1fr;
    }

    .ctc-chat-placeholders-grid {
        flex-direction: column;
    }

    .ctc-chat-template-actions {
        flex-direction: column;
    }
}

/* ============================================
   BUTTON PREVIEW STYLES
   ============================================ */

.ctc-chat-whatsapp-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.ctc-chat-whatsapp-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ctc-chat-button-size-small {
    padding: 8px 16px;
    font-size: 14px;
}

.ctc-chat-button-size-large {
    padding: 16px 32px;
    font-size: 18px;
}

.ctc-chat-whatsapp-icon svg {
    width: 20px;
    height: 20px;
}

.ctc-chat-button-size-small .ctc-chat-whatsapp-icon svg {
    width: 16px;
    height: 16px;
}

.ctc-chat-button-size-large .ctc-chat-whatsapp-icon svg {
    width: 24px;
    height: 24px;
}
