/* Estils Formularis MG */
.mg-form-wrapper {
    width: 100%;
    margin: 1rem 0;
}

.mg-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 24px;
}

/* Tablet i mòbils grans (stack earlier if narrow) */
@media (max-width: 980px) {
    .mg-form-grid {
        gap: 0 15px;
    }
}

/* Mòbils i Tablets en vertical */
@media (max-width: 767px) {
    .mg-form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .mg-form-grid .mg-form-actions {
        grid-column: span 1;
    }
}

.mg-form-grid .mg-form-actions {
    grid-column: span 2;
    margin-top: 10px;
}

/* Nou sistema de files flexibles */
.mg-form-flex-row {
    display: flex;
    gap: 24px;
    margin-bottom: 1.2rem;
}

.mg-form-flex-row>.mg-form-field,
.mg-form-flex-row>.mg-form-row {
    flex: 1 1 0;
    margin-bottom: 0 !important;
}

/* Tablet i mòbils */
@media (max-width: 767px) {
    .mg-form-flex-row {
        flex-direction: column;
        gap: 0;
    }

    .mg-form-flex-row>.mg-form-field,
    .mg-form-flex-row>.mg-form-row {
        margin-bottom: 1.2rem !important;
    }

    .mg-form-flex-row>.mg-form-row:last-child {
        margin-bottom: 0 !important;
    }
}

.mg-form-row,
.mg-form-field {
    margin-bottom: 1.2rem;
}

.mg-form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--mg-text-main);
}

.mg-static-text {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #f8f9fa;
    /* Light grey background */
    color: var(--mg-text-main);
    font-family: inherit;
    font-size: 15px;
    min-height: 44px;
    /* Match input height */
    display: flex;
    align-items: center;
}

/*
.mg-form-row input[type="text"],
.mg-form-row input[type="email"],
.mg-form-row input[type="number"],
.mg-form-row input[type="tel"],
.mg-form-row input[type="password"],
.mg-form-row select,
.mg-form-row textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--mg-border);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: var(--mg-bg);
    color: var(--mg-text-main);
    font-family: inherit;
    font-size: 15px;
}
*/

.mg-form-row input[type="text"]:focus,
.mg-form-row input[type="email"]:focus,
.mg-form-row input[type="number"]:focus,
.mg-form-row input[type="tel"]:focus,
.mg-form-row input[type="password"]:focus,
.mg-form-row select:focus,
.mg-form-row textarea:focus {
    outline: none;
    border-color: var(--mg-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.mg-form-row textarea,
.comment-form-comment textarea {
    width: 100% !important;
    min-height: 120px;
    resize: vertical;
}

/* Botons estil Divi / MobilGes */
.et_pb_button {
    cursor: pointer !important;
}

/* Modern Radio Buttons (Chips) */
.mg-radio-modern-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.mg-radio-modern-label {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #cdcdce;
    border: 2px solid transparent;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500 !important;
    color: #5f6368;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.mg-radio-modern-label:hover {
    background: #b8babd;
}

.mg-radio-modern-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mg-radio-modern-group input[type="radio"]:checked+.mg-radio-modern-label {
    background: #e1effe;
    color: var(--mg-primary);
    border-color: var(--mg-primary);
    box-shadow: 0 2px 4px rgba(28, 100, 242, 0.1);
}

/* Efecte activació (micro-animació) */
.mg-radio-modern-group input[type="radio"]:checked+.mg-radio-modern-label:active {
    transform: scale(0.95);
}

/* Priority Colors for Incident Table */
table.dataTable tbody tr.mg-prio-urgent,
table.dataTable tbody tr.mg-prio-urgente {
    background-color: #fca5a5 !important;
    /* Red-300 */
}

table.dataTable tbody tr.mg-prio-alta,
table.dataTable tbody tr.mg-prio-high {
    background-color: #fdba74 !important;
    /* Orange-300 */
}

table.dataTable tbody tr.mg-prio-normal,
table.dataTable tbody tr.mg-prio-mitjana,
table.dataTable tbody tr.mg-prio-medium {
    background-color: #fff !important;
    /* White */
}

table.dataTable tbody tr.mg-prio-baixa,
table.dataTable tbody tr.mg-prio-low {
    background-color: #86efac !important;
    /* Green-300 */
}

/* Ensure hover effect still works visibly */
table.dataTable tbody tr.mg-prio-urgent:hover {
    background-color: #f87171 !important;
}

table.dataTable tbody tr.mg-prio-alta:hover {
    background-color: #fb923c !important;
}

table.dataTable tbody tr.mg-prio-baixa:hover {
    background-color: #4ade80 !important;
}

/* Post Comments (Threaded) Styles */
.mg-post-comments-container {
    margin: 2rem 0;
}

.mg-comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 2rem;
}

.mg-comment-item {
    background: #fff;
    border: 1px solid var(--mg-border);
    border-left: 4px solid var(--mg-primary);
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    position: relative;
    transition: transform 0.2s ease;
}

.mg-comment-item:hover {
    transform: translateX(5px);
}

.mg-comment-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.mg-comment-author {
    color: var(--mg-primary);
}

.mg-comment-date {
    color: #666;
}

.mg-comment-content {
    color: var(--mg-text-main);
    line-height: 1.5;
    margin-bottom: 0.8rem;
}

.mg-comment-actions {
    text-align: right;
}

.mg-reply-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mg-primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--mg-primary);
}

.mg-comments-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 1rem;
}

.mg-pag-btn {
    padding: 6px 12px;
    border: 1px solid var(--mg-border);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.mg-pag-btn.active {
    background: var(--mg-primary);
    color: #fff;
    border-color: var(--mg-primary);
}

/* Response Form Handling */
.mg-post-comment-form-section.is-replying {
    margin: 10px 0 10px 30px;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px dashed var(--mg-primary);
    border-radius: 8px;
}

.mg-comment-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.mg-btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.mg-comments-list-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}