/* Admin Panel Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --secondary-color: #00a86b;
    --danger-color: #dc3545;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --border-color: #e0e0e0;
    --text-color: #333;
    --text-light: #666;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--dark-color);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.sidebar-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-item.active {
    background: var(--primary-color);
    color: var(--white);
    border-left: 4px solid var(--secondary-color);
}

.nav-item .icon {
    font-size: 1.3rem;
}

/* Main Content */
.admin-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 2rem;
    color: var(--dark-color);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

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

.btn-edit {
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-delete {
    background: var(--danger-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Articles Filters */
.articles-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

/* Articles Table */
.articles-table {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light-color);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

tbody tr:hover {
    background: var(--light-color);
}

.article-image {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.article-image img{
    width: 100%;
    height: auto;
    display: block;
    
}

.article-title {
    font-weight: 600;
    color: var(--dark-color);
}

.status-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.status-draft {
    background: #fff3cd;
    color: #856404;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* Form Styles */
.article-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group.half-width {
    grid-column: span 1;
}

label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

input[type="text"],
input[type="url"],
input[type="datetime-local"],
textarea,
select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
}

small {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.char-count,
.char-count-meta-title,
.char-count-meta-desc {
    color: var(--text-light);
}

.char-count.warning,
.char-count-meta-title.warning,
.char-count-meta-desc.warning {
    color: #ff6b6b;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    cursor: pointer;
}

.toggle-inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 30px;
    transition: 0.3s;
}

.toggle-switch-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input[type="checkbox"]:checked + .toggle-label .toggle-inner {
    background: var(--secondary-color);
}

input[type="checkbox"]:checked + .toggle-label .toggle-switch-slider {
    transform: translateX(30px);
}

.toggle-text {
    font-weight: 600;
    color: var(--text-color);
}

/* Image Preview */
.image-preview {
    margin-top: 1rem;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.image-preview p {
    color: var(--text-light);
}

/* Content Editor */
.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.content-editor {
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    background: var(--white);
    overflow-y: auto;
}

.content-editor:focus {
    outline: none;
    border-color: var(--primary-color);
}

.content-editor[placeholder]:empty:before {
    content: attr(placeholder);
    color: var(--text-light);
}

.content-editor h2 {
    font-size: 1.8rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.content-editor h3 {
    font-size: 1.4rem;
    margin-top: 1.2rem;
    margin-bottom: 0.8rem;
}

.content-editor p {
    margin-bottom: 1rem;
}

.content-editor ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

/* Tags Input */
.tags-input-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: var(--white);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.tag-remove {
    cursor: pointer;
    font-weight: bold;
}

#tagsInput {
    flex: 1;
    border: none;
    padding: 0.5rem;
    font-size: 1rem;
    min-width: 150px;
}

#tagsInput:focus {
    outline: none;
}

/* SEO Preview */
.seo-preview {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: 8px;
}

.seo-preview h4 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.google-preview {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 600px;
}

.preview-url {
    color: #006621;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.preview-title {
    color: #1a0dab;
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 0.3rem;
    cursor: pointer;
}

.preview-title:hover {
    text-decoration: underline;
}

.preview-description {
    color: #545454;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--light-color);
}

/* 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;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.modal-content p {
    margin-bottom: 2rem;
    color: var(--text-light);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .admin-content {
        margin-left: 220px;
    }

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

    .form-group.half-width {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .admin-content {
        margin-left: 0;
        padding: 1rem;
    }

    .content-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .articles-filters {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .articles-table {
        overflow-x: auto;
    }

    table {
        min-width: 800px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
