/**
 * JJ Nyhedsbrev Frontend Styles
 * Version 1.5.0
 * Scoped med .jj-news-* prefix
 */

/* ========================================
   CREATE BUTTON
   ======================================== */
.jj-news-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #4CAF50;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.jj-news-create-btn:hover {
    background: #43A047;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.jj-news-create-btn::before {
    content: "+";
    font-size: 18px;
    font-weight: 700;
}

/* ========================================
   NOTICES
   ======================================== */
.jj-news-notice {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.jj-news-notice-success {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    color: #2E7D32;
    border: 1px solid #A5D6A7;
}

.jj-news-notice-success::before {
    content: "✅";
}

.jj-news-notice-error {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    color: #C62828;
    border: 1px solid #EF9A9A;
}

.jj-news-notice-error::before {
    content: "❌";
}

/* ========================================
   EDITOR WRAPPER - FULL WIDTH
   ======================================== */
.jj-news-editor-wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.jj-news-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.jj-news-editor-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}

/* ========================================
   EDITOR FORM
   ======================================== */
.jj-news-editor-form {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
}

.jj-news-form-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: end;
    margin-bottom: 24px;
}

.jj-news-field {
    margin-bottom: 24px;
}

.jj-news-field:last-of-type {
    margin-bottom: 0;
}

.jj-news-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.jj-news-field input[type="text"],
.jj-news-field textarea,
.jj-news-field select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.jj-news-field input[type="text"]:focus,
.jj-news-field textarea:focus,
.jj-news-field select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
    background: #fff;
}

.jj-news-field input[type="text"]::placeholder,
.jj-news-field textarea::placeholder {
    color: #999;
}

.jj-news-field textarea {
    resize: vertical;
    min-height: 80px;
}

.jj-news-field select {
    cursor: pointer;
    background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 16px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 44px;
}

.jj-news-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

.jj-news-field-checkbox label,
.jj-news-field-checkbox-inline label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 8px;
    transition: background 0.2s;
}

.jj-news-field-checkbox label:hover,
.jj-news-field-checkbox-inline label:hover {
    background: #eeeeee;
}

.jj-news-field-checkbox input[type="checkbox"],
.jj-news-field-checkbox-inline input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #4CAF50;
}

/* Rich text editor wrapper */
.jj-news-field-editor {
    margin-bottom: 24px;
}

.jj-news-field-editor .wp-editor-wrap {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.jj-news-field-editor .wp-editor-wrap:focus-within {
    border-color: #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.jj-news-field-editor .wp-editor-tabs {
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.jj-news-field-editor .wp-switch-editor {
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-weight: 500;
}

.jj-news-field-editor .wp-switch-editor.switch-tmce:focus,
.jj-news-field-editor .wp-switch-editor.switch-html:focus {
    box-shadow: none;
}

.jj-news-field-editor .mce-toolbar-grp {
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

.jj-news-field-editor iframe {
    min-height: 350px !important;
}

/* ========================================
   BUTTONS
   ======================================== */
.jj-news-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.jj-news-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jj-news-btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.jj-news-btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.jj-news-btn-primary:hover {
    background: linear-gradient(135deg, #43A047 0%, #388E3C 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    color: #fff;
}

.jj-news-btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.jj-news-btn-secondary:hover {
    background: #eee;
}

.jj-news-btn-outline {
    background: transparent;
    color: #4CAF50;
    border: 2px solid #4CAF50;
    padding: 10px 20px;
    font-size: 14px;
}

.jj-news-btn-outline:hover {
    background: #4CAF50;
    color: #fff;
}

/* ========================================
   MY NEWSLETTERS TABLE
   ======================================== */
.jj-news-my-list {
    margin-top: 48px;
}

.jj-news-my-list h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #1a1a1a;
}

.jj-news-table-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
    overflow: hidden;
}

.jj-news-table {
    width: 100%;
    border-collapse: collapse;
}

.jj-news-table th {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 100%);
    color: #fff;
    padding: 16px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jj-news-table th:first-child {
    padding-left: 24px;
}

.jj-news-table th:last-child {
    padding-right: 24px;
}

.jj-news-th-actions {
    text-align: center !important;
    width: 140px;
}

.jj-news-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    vertical-align: middle;
}

.jj-news-table td:first-child {
    padding-left: 24px;
}

.jj-news-table td:last-child {
    padding-right: 24px;
}

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

.jj-news-table tr:hover td {
    background: #fafafa;
}

.jj-news-td-title {
    font-weight: 600;
    color: #1a1a1a;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jj-news-td-date {
    color: #666;
    white-space: nowrap;
}

.jj-news-td-actions {
    text-align: center;
    white-space: nowrap;
}

.jj-news-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 16px;
}

.jj-news-action-view {
    background: #E3F2FD;
}

.jj-news-action-view:hover {
    background: #BBDEFB;
}

.jj-news-action-edit {
    background: #FFF3E0;
}

.jj-news-action-edit:hover {
    background: #FFE0B2;
}

.jj-news-action-delete {
    background: #FFEBEE;
}

.jj-news-action-delete:hover {
    background: #FFCDD2;
}

.jj-news-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.jj-news-badge-nyhedsbrev-medarbejd {
    background: #E3F2FD;
    color: #1565C0;
}

.jj-news-badge-nyhedsbrev-ledere {
    background: #FFF3E0;
    color: #E65100;
}

.jj-news-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.jj-news-status-publish {
    background: #E8F5E9;
    color: #2E7D32;
}

.jj-news-status-draft {
    background: #FFF3E0;
    color: #E65100;
}

.jj-news-status-pending {
    background: #FFF8E1;
    color: #F57F17;
}

.jj-news-link {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
}

.jj-news-link:hover {
    text-decoration: underline;
}

/* Empty state */
.jj-news-empty-state {
    text-align: center;
    padding: 60px 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
}

.jj-news-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.jj-news-empty-state p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.jj-news-empty-hint {
    margin-top: 8px !important;
    font-size: 14px !important;
    color: #999 !important;
}

/* ========================================
   NEWSLETTER LIST (FEED)
   ======================================== */
.jj-news-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.jj-news-list-empty {
    padding: 40px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.jj-news-item {
    background: #fff;
    padding: 24px 28px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.jj-news-item:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.jj-news-item.jj-news-featured {
    border-left-color: #4CAF50;
    background: linear-gradient(135deg, #fff 0%, #f0fff0 100%);
}

.jj-news-item.jj-news-target-leader {
    border-left-color: #FF9800;
}

.jj-news-date {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jj-news-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.jj-news-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.jj-news-title a:hover {
    color: #4CAF50;
}

.jj-news-excerpt {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.jj-news-read-more {
    color: #4CAF50;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.jj-news-read-more:hover {
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .jj-news-editor-wrap {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .jj-news-editor-wrap {
        padding: 0 16px;
    }
    
    .jj-news-editor-form {
        padding: 20px;
    }
    
    .jj-news-form-grid {
        grid-template-columns: 1fr;
    }
    
    .jj-news-editor-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .jj-news-actions {
        flex-direction: column;
    }
    
    .jj-news-btn {
        width: 100%;
        justify-content: center;
    }
    
    .jj-news-table-wrap {
        overflow-x: auto;
    }
    
    .jj-news-table {
        min-width: 600px;
    }
    
    .jj-news-item {
        padding: 20px;
    }
    
    .jj-news-empty-state {
        padding: 40px 20px;
    }
}

/* ========================================
   RECIPIENTS PREVIEW
   ======================================== */
.jj-news-recipients-preview {
    margin-top: 16px;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
}

.jj-news-recipients-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f1 100%);
    border-bottom: 1px solid #e0e0e0;
}

.jj-news-recipients-icon {
    font-size: 18px;
}

.jj-news-recipients-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    flex: 1;
}

.jj-news-recipients-count {
    font-size: 13px;
    font-weight: 600;
    color: #4CAF50;
    background: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #c8e6c9;
}

.jj-news-recipients-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
}

.jj-news-recipients-list.collapsed {
    max-height: 200px;
}

.jj-news-recipients-loading,
.jj-news-recipients-empty,
.jj-news-recipients-error {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.jj-news-recipients-error {
    color: #c62828;
}

.jj-news-recipients-ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.jj-news-recipient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    font-size: 13px;
    transition: all 0.15s ease;
}

.jj-news-recipient-item:hover {
    border-color: #4CAF50;
    background: #f0fff0;
}

.jj-news-recipient-name {
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.jj-news-recipient-role {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.jj-news-recipient-role.role-medarbejder {
    background: #E3F2FD;
    color: #1565C0;
}

.jj-news-recipient-role.role-leder {
    background: #FFF3E0;
    color: #E65100;
}

.jj-news-recipient-role.role-ejer {
    background: #F3E5F5;
    color: #7B1FA2;
}

.jj-news-recipient-role.role-administrator {
    background: #FFEBEE;
    color: #C62828;
}

.jj-news-recipients-toggle {
    padding: 10px 16px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
}

.jj-news-recipients-toggle-btn {
    width: 100%;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #4CAF50;
    cursor: pointer;
    transition: all 0.2s;
}

.jj-news-recipients-toggle-btn:hover {
    background: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}

/* Responsive for recipients */
@media (max-width: 768px) {
    .jj-news-recipients-ul {
        grid-template-columns: 1fr;
    }
    
    .jj-news-recipients-list {
        max-height: 300px;
    }
    
    .jj-news-recipients-list.collapsed {
        max-height: 150px;
    }
}
