/**
 * ENNU Email Recipient Configuration Styles
 * Brand Colors: #1A2744 (Dark Blue), #C9A962 (Gold)
 *
 * @package ENNUEmail
 * @since 12.9.0
 */

/* === Wrapper === */
.ennu-email-recipient-config-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

/* === Tab Navigation === */
.ennu-email-tabs {
    display: flex;
    border-bottom: 2px solid #e5e5e5;
    margin-bottom: 30px;
    gap: 10px;
}

.ennu-tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.ennu-tab-btn:hover {
    color: #1A2744;
    background: #f8f9fa;
}

.ennu-tab-btn.active {
    color: #1A2744;
    border-bottom-color: #C9A962;
    background: transparent;
}

/* === Section Header === */
.ennu-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.ennu-section-header h2 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: #1A2744;
    font-weight: 600;
}

.ennu-help-text {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* === Buttons === */
.ennu-btn-primary {
    background: #C9A962;
    color: #1A2744;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.ennu-btn-primary:hover {
    background: #b89752;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.ennu-btn-secondary {
    background: #f8f9fa;
    color: #1A2744;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 14px;
}

.ennu-btn-secondary:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.ennu-btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ennu-btn-small:hover {
    background: #f8f9fa;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* === Groups Grid === */
.ennu-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.ennu-group-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
}

.ennu-group-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.ennu-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ennu-group-header h4 {
    margin: 0;
    color: #1A2744;
    font-size: 16px;
    font-weight: 600;
}

.ennu-group-description {
    color: #666;
    font-size: 14px;
    margin: 0 0 15px 0;
    min-height: 40px;
}

.ennu-group-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.ennu-meta-item {
    font-size: 13px;
    color: #666;
}

.ennu-group-actions {
    display: flex;
    gap: 8px;
}

/* === Badges === */
.ennu-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.ennu-badge.active {
    background: #d4edda;
    color: #155724;
}

.ennu-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* === Table === */
.ennu-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ennu-table th {
    background: #1A2744;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.ennu-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 14px;
}

.ennu-table tr:last-child td {
    border-bottom: none;
}

.ennu-table tbody tr:hover {
    background: #f8f9fa;
}

.ennu-table code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

/* === Filters === */
.ennu-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    flex-wrap: wrap;
}

.ennu-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ennu-filter-group label {
    font-weight: 600;
    color: #1A2744;
    white-space: nowrap;
    font-size: 14px;
}

.ennu-filter-group select,
.ennu-filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.ennu-filter-group select:focus,
.ennu-filter-group input:focus {
    outline: none;
    border-color: #C9A962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.1);
}

/* === Modal === */
.ennu-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ennu-modal-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.ennu-modal-large {
    max-width: 900px;
}

.ennu-modal-content h3 {
    margin: 0 0 20px 0;
    color: #1A2744;
    font-size: 20px;
}

.ennu-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.ennu-modal-close:hover {
    color: #333;
}

/* === Forms === */
.ennu-form-group {
    margin-bottom: 20px;
}

.ennu-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #1A2744;
    font-size: 14px;
}

.ennu-form-group label .required {
    color: #dc3545;
}

.ennu-form-group input[type="text"],
.ennu-form-group input[type="number"],
.ennu-form-group select,
.ennu-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.ennu-form-group input:focus,
.ennu-form-group select:focus,
.ennu-form-group textarea:focus {
    outline: none;
    border-color: #C9A962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.1);
}

.ennu-form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.ennu-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* === Member Rows === */
.ennu-member-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.ennu-member-row .member-type {
    flex: 0 0 120px;
}

.ennu-member-row .member-value {
    flex: 1;
}

/* === Toggle Switch === */
.ennu-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.ennu-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ennu-toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    margin-right: 10px;
    transition: 0.2s;
}

.ennu-toggle input:checked + .ennu-toggle-slider {
    background: #C9A962;
}

.ennu-toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.ennu-toggle input:checked + .ennu-toggle-slider:before {
    transform: translateX(26px);
}

/* === Modal Actions === */
.ennu-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

/* === Toast Notification === */
.ennu-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #155724;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10001;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.ennu-toast.error {
    background: #dc3545;
}

.ennu-toast.success {
    background: #28a745;
}

@keyframes slideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === Empty State === */
.ennu-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

/* === Loading === */
.ennu-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

.ennu-loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* === Error State === */
.ennu-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

.ennu-email-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

/* === Responsive === */
@media (max-width: 768px) {
    .ennu-email-recipient-config-wrapper {
        padding: 15px;
    }

    .ennu-email-tabs {
        flex-direction: column;
        gap: 5px;
    }

    .ennu-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .ennu-groups-grid {
        grid-template-columns: 1fr;
    }

    .ennu-filters {
        flex-direction: column;
        gap: 15px;
    }

    .ennu-filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .ennu-filter-group select,
    .ennu-filter-group input {
        width: 100%;
        min-width: 0;
    }

    .ennu-form-row {
        grid-template-columns: 1fr;
    }

    .ennu-modal-content {
        width: 95%;
        padding: 20px;
    }

    .ennu-table {
        font-size: 12px;
    }

    .ennu-table th,
    .ennu-table td {
        padding: 8px;
    }

    .ennu-member-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ennu-member-row .member-type,
    .ennu-member-row .member-value {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* === Accessibility === */
.ennu-btn-primary:focus,
.ennu-btn-secondary:focus,
.ennu-btn-small:focus {
    outline: 2px solid #C9A962;
    outline-offset: 2px;
}

.ennu-tab-btn:focus {
    outline: 2px solid #C9A962;
    outline-offset: -2px;
}

/* === Print Styles === */
@media print {
    .ennu-email-tabs,
    .ennu-section-header button,
    .ennu-group-actions,
    .ennu-modal,
    .ennu-toast,
    .ennu-filters {
        display: none !important;
    }

    .ennu-email-recipient-config-wrapper {
        max-width: none;
    }

    .ennu-tab-content {
        display: block !important;
    }
}
