/* =============================================
   News Articles Styles
   ============================================= */

/* Container */
.news-articles-container,
.news-article-form-container {
    padding: 0;
}

/* Header */
.news-articles-header,
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.header-left {
    flex: 1;
}

.header-left h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.header-left p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.header-right {
    display: flex;
    gap: 1rem;
}

/* Back Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    color: #374151;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.btn-back:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Filters */
.news-articles-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table Wrapper */
.news-articles-table-wrapper {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Table */
.news-articles-table {
    width: 100%;
    border-collapse: collapse;
}

.news-articles-table thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.news-articles-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-articles-table td {
    padding: 1rem;
    border-top: 1px solid #f3f4f6;
    font-size: 0.875rem;
    color: #374151;
}

.news-articles-table tbody tr {
    transition: background-color 0.2s ease;
}

.news-articles-table tbody tr:hover {
    background-color: #f9fafb;
}

/* Article Image */
.article-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.article-image-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
}

/* Article Title and Summary */
.article-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.article-summary {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-draft {
    background: #fef3c7;
    color: #92400e;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: transparent;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-edit {
    color: #3b82f6;
    background: #eff6ff;
}

.btn-edit:hover {
    background: #dbeafe;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-delete {
    color: #ef4444;
    background: #fef2f2;
}

.btn-delete:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-icon:active {
    transform: translateY(0);
}

/* Form Styles */
.news-article-form {
    background: #fff;
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.required {
    color: #dc2626;
}

.form-control {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* CKEditor 5 Specific */
.ck.ck-editor {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.ck.ck-editor__main>.ck-editor__editable {
    min-height: 400px !important;
    max-height: 600px;
    overflow-y: auto;
}

.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused) {
    border-color: #d1d5db;
}

.ck.ck-toolbar {
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.ck.ck-toolbar .ck-toolbar__items {
    flex-wrap: wrap;
}

.ck-content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Make editor match admin panel style */
.ck.ck-button:not(.ck-disabled):hover {
    background: #e5e7eb !important;
}

.ck.ck-button.ck-on {
    background: #dbeafe !important;
    color: #1e40af !important;
}

/* Image Upload Container */
.image-upload-container {
    position: relative;
}

.image-preview {
    width: 100%;
    min-height: 300px;
    max-height: 400px;
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
    overflow: hidden;
}

.image-preview:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.image-preview svg {
    color: #9ca3af;
}

.image-preview p {
    margin: 0;
    color: #374151;
    font-size: 0.875rem;
    text-align: center;
}

.image-preview p.text-muted {
    color: #6b7280;
    font-size: 0.75rem;
}

.image-preview.has-image {
    padding: 1rem;
    border-style: solid;
    border-color: #e5e7eb;
    background: #fff;
}

.image-preview.has-image:hover {
    border-color: #d1d5db;
    background: #fff;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.btn-remove-image {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-top: 0.75rem;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-image:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.btn-remove-image svg {
    width: 18px;
    height: 18px;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.form-check-label {
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: #dc2626;
    color: #fff;
}

.btn-primary:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Validation */
.text-danger {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.input-validation-error {
    border-color: #dc2626 !important;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: #6b7280;
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    font-size: 0.875rem;
    margin: 0 0 1.5rem 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0 0 0.75rem 0;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.5;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-body .text-muted {
    color: #6b7280;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {

    .news-articles-header,
    .form-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .news-articles-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .news-articles-table {
        min-width: 700px;
    }

    .news-articles-table th,
    .news-articles-table td {
        padding: 0.75rem 0.5rem;
    }

    .article-image,
    .article-image-placeholder {
        width: 50px;
        height: 50px;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .form-actions .btn {
        width: 100%;
    }

    .news-articles-filters {
        flex-direction: column;
    }

    .search-box {
        max-width: 100%;
    }
}