/**
 * Widget Config Alert Section Fix
 * Fixes layout issues in "Cảnh báo thông minh" section of widget configuration
 * Version: 1.0
 * Date: 2025-11-13
 */

/* Target all config properties in alert section */
.config-group .config-property {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    /* Override any grid layout */
    grid-template-columns: none !important;
}

/* Label section - full width, stacked vertically */
.config-group .config-property-label {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.config-group .config-property-label label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    display: block;
}

.dark .config-group .config-property-label label {
    color: #f3f4f6;
}

.config-group .config-property-label .config-property-desc {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
    margin: 0;
}

.dark .config-group .config-property-label .config-property-desc {
    color: #9ca3af;
}

/* Input section - full width */
.config-group .config-property-input {
    width: 100%;
}

.config-group .config-property-input input[type="text"],
.config-group .config-property-input input[type="number"],
.config-group .config-property-input select,
.config-group .config-property-input textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    color: #1f2937;
    font-size: 0.875rem;
}

.dark .config-group .config-property-input input[type="text"],
.dark .config-group .config-property-input input[type="number"],
.dark .config-group .config-property-input select,
.dark .config-group .config-property-input textarea {
    background: #1f2937;
    border-color: #4b5563;
    color: #e5e7eb;
}

.config-group .config-property-input input[type="text"]:focus,
.config-group .config-property-input input[type="number"]:focus,
.config-group .config-property-input select:focus,
.config-group .config-property-input textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Checkbox styling */
.config-group .config-property-input input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* Textarea specific */
.config-group .config-property-input textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
}

/* Zalo template specific styling */
.config-group .zalo-template-textarea {
    margin-bottom: 0.5rem;
}

.config-group .zalo-template-preview {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.dark .config-group .zalo-template-preview {
    background: #374151;
    border-color: #4b5563;
}

.config-group .zalo-template-preview strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #3b82f6;
}

.dark .config-group .zalo-template-preview strong {
    color: #60a5fa;
}

.config-group .zalo-template-preview .preview-content {
    display: block;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    color: #374151;
}

.dark .config-group .zalo-template-preview .preview-content {
    color: #d1d5db;
}

.config-group .template-variables-help {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #dbeafe;
    border-left: 3px solid #3b82f6;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

.dark .config-group .template-variables-help {
    background: #1e3a8a;
    border-left-color: #60a5fa;
}

.config-group .template-variables-help strong {
    color: #1e40af;
    margin-right: 0.5rem;
}

.dark .config-group .template-variables-help strong {
    color: #93c5fd;
}

/* Range slider with number input */
.config-group .config-property-input .flex.items-center.gap-2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.config-group .config-slider {
    flex: 1;
    height: 0.5rem;
    border-radius: 0.25rem;
    background: #e5e7eb;
    appearance: none;
    cursor: pointer;
}

.dark .config-group .config-slider {
    background: #4b5563;
}

.config-group .config-slider::-webkit-slider-thumb {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
}

.config-group .config-slider::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
}

.config-group .config-slider-value {
    width: 5rem !important;
    text-align: center;
}

/* Config group header */
.config-group-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.dark .config-group-header {
    border-bottom-color: #4b5563;
}

.config-group-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.dark .config-group-header h4 {
    color: #f3f4f6;
}

.config-group-header p {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.dark .config-group-header p {
    color: #9ca3af;
}

/* Error message for complex properties */
.config-group .col-span-2.text-sm.text-gray-500 {
    width: 100%;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 0.375rem;
    margin: 0.5rem 0;
}

.dark .config-group .col-span-2.text-sm.text-gray-500 {
    background: #78350f;
    border-color: #92400e;
    color: #fef3c7;
}

.config-group .col-span-2.text-sm.text-gray-500 code {
    background: white;
    color: #7c2d12;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

.dark .config-group .col-span-2.text-sm.text-gray-500 code {
    background: #451a03;
    color: #fed7aa;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .config-group .config-property {
        gap: 0.75rem;
    }

    .config-group .config-property-label label {
        font-size: 0.875rem;
    }

    .config-group .config-property-input input,
    .config-group .config-property-input select,
    .config-group .config-property-input textarea {
        font-size: 0.875rem;
        padding: 0.5rem;
    }

    .config-group .config-slider-value {
        width: 4rem !important;
    }
}

/* Spacing between properties */
.config-group-body > .config-property:not(:last-child) {
    margin-bottom: 1.5rem;
}

/* Visual separation for different sections */
.config-group-body > .config-property:nth-child(5),
.config-group-body > .config-property:nth-child(8),
.config-group-body > .config-property:nth-child(12),
.config-group-body > .config-property:nth-child(15) {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #d1d5db;
}

.dark .config-group-body > .config-property:nth-child(5),
.dark .config-group-body > .config-property:nth-child(8),
.dark .config-group-body > .config-property:nth-child(12),
.dark .config-group-body > .config-property:nth-child(15) {
    border-top-color: #4b5563;
}
