/**
 * Alert Config Modal Layout Fix
 * Fixes column alignment issues in alert configuration modal
 * Version: 1.0
 */

/* Fix for alert config modal - override grid layout */
.alert-config-modal .config-property,
[data-modal="alert-config"] .config-property {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    grid-template-columns: none; /* Override grid */
}

/* Labels should be full width and stacked */
.alert-config-modal .config-property-label,
[data-modal="alert-config"] .config-property-label {
    width: 100%;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

/* Input containers should be full width */
.alert-config-modal .config-property-input,
[data-modal="alert-config"] .config-property-input {
    width: 100%;
}

/* Fix for checkbox groups (Template sections) */
.alert-config-modal .checkbox-group,
[data-modal="alert-config"] .checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    transition: all 0.2s;
}

.dark .alert-config-modal .checkbox-group,
.dark [data-modal="alert-config"] .checkbox-group {
    border-color: #4b5563;
    background: #374151;
}

.alert-config-modal .checkbox-group:hover,
[data-modal="alert-config"] .checkbox-group:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.dark .alert-config-modal .checkbox-group:hover,
.dark [data-modal="alert-config"] .checkbox-group:hover {
    border-color: #60a5fa;
    background: #1e3a8a;
}

/* Checkbox styling */
.alert-config-modal .checkbox-group input[type="checkbox"],
[data-modal="alert-config"] .checkbox-group input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    cursor: pointer;
}

/* Label next to checkbox */
.alert-config-modal .checkbox-group label,
[data-modal="alert-config"] .checkbox-group label {
    flex: 1;
    cursor: pointer;
    user-select: none;
    margin: 0;
    font-weight: 500;
}

/* Template sections with nested content */
.alert-config-modal .template-section,
[data-modal="alert-config"] .template-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
}

.dark .alert-config-modal .template-section,
.dark [data-modal="alert-config"] .template-section {
    border-color: #4b5563;
    background: #374151;
}

/* Template header with checkbox */
.alert-config-modal .template-header,
[data-modal="alert-config"] .template-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dark .alert-config-modal .template-header,
.dark [data-modal="alert-config"] .template-header {
    background: #1f2937;
    border-color: #4b5563;
}

.alert-config-modal .template-header:hover,
[data-modal="alert-config"] .template-header:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.dark .alert-config-modal .template-header:hover,
.dark [data-modal="alert-config"] .template-header:hover {
    border-color: #60a5fa;
    background: #1e3a8a;
}

.alert-config-modal .template-header input[type="checkbox"],
[data-modal="alert-config"] .template-header input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.alert-config-modal .template-header label,
[data-modal="alert-config"] .template-header label {
    flex: 1;
    font-weight: 600;
    margin: 0;
}

/* Template content (hidden by default) */
.alert-config-modal .template-content,
[data-modal="alert-config"] .template-content {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-left: 2rem;
    border-left: 2px solid #e5e7eb;
}

.dark .alert-config-modal .template-content,
.dark [data-modal="alert-config"] .template-content {
    border-left-color: #4b5563;
}

/* Show template content when checkbox is checked */
.alert-config-modal .template-header input[type="checkbox"]:checked ~ .template-content,
[data-modal="alert-config"] .template-header input[type="checkbox"]:checked ~ .template-content,
.alert-config-modal .template-content.active,
[data-modal="alert-config"] .template-content.active {
    display: flex;
}

/* Textarea for template input */
.alert-config-modal textarea,
[data-modal="alert-config"] textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    color: #1f2937;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
}

.dark .alert-config-modal textarea,
.dark [data-modal="alert-config"] textarea {
    background: #1f2937;
    border-color: #4b5563;
    color: #e5e7eb;
}

.alert-config-modal textarea:focus,
[data-modal="alert-config"] textarea:focus {
    outline: none;
    border-color: #3b82f6;
    ring: 2px;
    ring-color: #93c5fd;
}

/* Sound selection dropdown */
.alert-config-modal select,
[data-modal="alert-config"] select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    color: #1f2937;
}

.dark .alert-config-modal select,
.dark [data-modal="alert-config"] select {
    background: #1f2937;
    border-color: #4b5563;
    color: #e5e7eb;
}

/* Volume slider container */
.alert-config-modal .volume-control,
[data-modal="alert-config"] .volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-config-modal .volume-control .config-slider,
[data-modal="alert-config"] .volume-control .config-slider {
    flex: 1;
}

.alert-config-modal .volume-control .volume-value,
[data-modal="alert-config"] .volume-control .volume-value {
    min-width: 4rem;
    text-align: center;
    font-weight: 600;
    color: #3b82f6;
}

/* Error/Warning messages */
.alert-config-modal .config-hint,
[data-modal="alert-config"] .config-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    font-size: 0.875rem;
}

.alert-config-modal .config-hint.info,
[data-modal="alert-config"] .config-hint.info {
    background: #dbeafe;
    border-color: #93c5fd;
}

.alert-config-modal .config-hint.error,
[data-modal="alert-config"] .config-hint.error {
    background: #fee2e2;
    border-color: #fca5a5;
}

.dark .alert-config-modal .config-hint,
.dark [data-modal="alert-config"] .config-hint {
    background: #78350f;
    border-color: #92400e;
    color: #fef3c7;
}

.dark .alert-config-modal .config-hint.info,
.dark [data-modal="alert-config"] .config-hint.info {
    background: #1e3a8a;
    border-color: #1e40af;
    color: #dbeafe;
}

.dark .alert-config-modal .config-hint.error,
.dark [data-modal="alert-config"] .config-hint.error {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fee2e2;
}

/* Icon in hints */
.alert-config-modal .config-hint svg,
[data-modal="alert-config"] .config-hint svg {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

/* Improve spacing between sections */
.alert-config-modal .config-group-body > *:not(:last-child),
[data-modal="alert-config"] .config-group-body > *:not(:last-child) {
    margin-bottom: 1rem;
}

/* Fix modal width to prevent cramping */
.alert-config-modal .modal-container,
[data-modal="alert-config"] .modal-container {
    max-width: 600px;
    width: 90%;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .alert-config-modal .modal-container,
    [data-modal="alert-config"] .modal-container {
        width: 95%;
        max-width: none;
    }

    .alert-config-modal .template-content,
    [data-modal="alert-config"] .template-content {
        margin-left: 1rem;
    }

    .alert-config-modal .checkbox-group,
    [data-modal="alert-config"] .checkbox-group {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Better visual hierarchy */
.alert-config-modal .section-title,
[data-modal="alert-config"] .section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.dark .alert-config-modal .section-title,
.dark [data-modal="alert-config"] .section-title {
    color: #f3f4f6;
    border-bottom-color: #4b5563;
}

/* Divider between major sections */
.alert-config-modal .section-divider,
[data-modal="alert-config"] .section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
    margin: 1.5rem 0;
}

.dark .alert-config-modal .section-divider,
.dark [data-modal="alert-config"] .section-divider {
    background: linear-gradient(to right, transparent, #4b5563, transparent);
}
