/**
 * GunnyLau Article Management Styles
 * CSS cho hệ thống quản lý bài viết
 */

/* ========================================
   Article Modal (Create/Edit)
   ======================================== */
.article-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.article-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.article-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    margin: 20px 0;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95) translateY(-20px);
    transition: all 0.3s ease;
}

.article-modal-overlay.show .article-modal {
    transform: scale(1) translateY(0);
}

.article-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.article-modal-header h2 {
    color: #ffffff;
    font-size: 24px;
    margin: 0;
}

.article-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.article-close:hover {
    background: rgba(255, 107, 53, 0.3);
    color: #ff6b35;
    transform: rotate(90deg);
}

/* Article Form */
.article-form {
    padding: 30px;
}

.article-form .form-row {
    display: flex;
    gap: 20px;
}

.article-form .flex-1 {
    flex: 1;
}

.article-form .flex-2 {
    flex: 2;
}

.article-form .form-group {
    margin-bottom: 20px;
    position: relative;
}

.article-form label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.article-form input[type="text"],
.article-form input[type="url"],
.article-form textarea,
.article-form select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.article-form input::placeholder,
.article-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.article-form input:focus,
.article-form textarea:focus,
.article-form select:focus {
    outline: none;
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
}

.article-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.article-form select option {
    background: #1a1a2e;
    color: #ffffff;
}

.char-count {
    position: absolute;
    right: 12px;
    bottom: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.thumbnail-preview {
    margin-top: 10px;
}

.thumbnail-preview img {
    max-width: 200px;
    max-height: 120px;
    border-radius: 8px;
    object-fit: cover;
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px 12px 0 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: #ff6b35;
    color: white;
    transform: translateY(-2px);
}

.toolbar-divider {
    width: 1px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 5px;
}

/* Editor Content */
.editor-content {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 12px 12px;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.8;
}

.editor-content:focus {
    outline: none;
    border-color: #ff6b35;
}

.editor-content:empty::before {
    content: attr(placeholder);
    color: rgba(255, 255, 255, 0.4);
}

.editor-content h2 {
    color: #ff6b35;
    font-size: 22px;
    margin: 20px 0 10px;
}

.editor-content h3 {
    color: #f7931e;
    font-size: 18px;
    margin: 15px 0 8px;
}

.editor-content p {
    margin: 10px 0;
}

.editor-content ul, .editor-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

.editor-content blockquote {
    border-left: 4px solid #ff6b35;
    padding-left: 15px;
    margin: 15px 0;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.editor-content pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.editor-content th, .editor-content td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px;
    text-align: left;
}

.editor-content th {
    background: rgba(255, 107, 53, 0.2);
}

.editor-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
}

.editor-content .video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 15px 0;
}

.editor-content .video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-draft {
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-draft:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-preview {
    padding: 14px 24px;
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid #3498db;
    border-radius: 12px;
    color: #3498db;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-preview:hover {
    background: #3498db;
    color: white;
}

.btn-publish {
    flex: 1;
    padding: 14px 24px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
}

.btn-publish:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.5);
}

.article-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    display: none;
}

.article-message:not(:empty) {
    display: block;
}

.article-message.error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.article-message.success {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

/* ========================================
   Insert Modals (Image, Link, Video)
   ======================================== */
.insert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.insert-modal.show {
    opacity: 1;
    visibility: visible;
}

.insert-modal-content {
    background: #1a1a2e;
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.insert-modal-content h3 {
    color: #ffffff;
    margin-bottom: 20px;
    font-size: 18px;
}

.insert-modal-content input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 12px;
}

.insert-modal-content input:focus {
    outline: none;
    border-color: #ff6b35;
}

.insert-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.insert-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-insert {
    background: #ff6b35;
    border: none;
    color: white;
}

.btn-insert:hover {
    background: #ff8c5a;
}

/* ========================================
   Preview Modal
   ======================================== */
.preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.preview-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.preview-modal {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 30px;
}

.preview-header h2 {
    color: #ffffff;
    font-size: 20px;
    margin: 0;
}

.preview-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
}

.preview-close:hover {
    background: rgba(255, 107, 53, 0.3);
}

.preview-article {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    color: #1a1a2e;
}

.preview-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.preview-category {
    background: #ff6b35;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.preview-title {
    font-size: 32px;
    color: #1a1a2e;
    margin-bottom: 15px;
    line-height: 1.3;
}

.preview-excerpt {
    font-size: 18px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.preview-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.preview-author .author-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.preview-author .author-name {
    font-weight: 600;
    color: #1a1a2e;
}

.preview-thumbnail {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 25px;
}

.preview-body {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.preview-body h2 {
    color: #1a1a2e;
    font-size: 24px;
    margin: 25px 0 15px;
}

.preview-body h3 {
    color: #333;
    font-size: 20px;
    margin: 20px 0 12px;
}

.preview-body p {
    margin: 15px 0;
}

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

/* ========================================
   Manage Modal
   ======================================== */
.manage-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.manage-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.manage-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
    transition: all 0.3s ease;
}

.manage-modal-overlay.show .manage-modal {
    transform: scale(1);
}

.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.manage-header h2 {
    color: #ffffff;
    font-size: 24px;
    margin: 0;
}

.manage-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.manage-close:hover {
    background: rgba(255, 107, 53, 0.3);
    color: #ff6b35;
}

.manage-tabs {
    display: flex;
    gap: 10px;
    padding: 20px 30px 0;
}

.manage-tab {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 10px 10px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.manage-tab:hover {
    color: rgba(255, 255, 255, 0.9);
}

.manage-tab.active {
    background: rgba(255, 107, 53, 0.15);
    border-color: #ff6b35;
    color: #ff6b35;
}

.manage-search {
    padding: 20px 30px;
}

.manage-search input {
    width: 100%;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
}

.manage-search input:focus {
    outline: none;
    border-color: #ff6b35;
}

.manage-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 30px;
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
}

.article-item {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
}

.article-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.article-thumb {
    width: 100px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

.article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 107, 53, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.article-info {
    flex: 1;
    min-width: 0;
}

.article-item .article-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.draft-badge {
    background: #f39c12;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.article-item .article-excerpt {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.article-actions button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-edit {
    background: rgba(52, 152, 219, 0.2);
}

.btn-edit:hover {
    background: #3498db;
}

.btn-publish-draft {
    background: rgba(39, 174, 96, 0.2);
}

.btn-publish-draft:hover {
    background: #27ae60;
}

.btn-delete {
    background: rgba(231, 76, 60, 0.2);
}

.btn-delete:hover {
    background: #e74c3c;
}

.manage-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-new-article {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-new-article:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.empty-icon {
    font-size: 60px;
    display: block;
    margin-bottom: 15px;
}

.empty-state p {
    margin-bottom: 20px;
}

.btn-write {
    padding: 12px 24px;
    background: #ff6b35;
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Notification */
.article-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(39, 174, 96, 0.4);
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10003;
}

.article-notification.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.article-notification.show {
    transform: translateX(0);
    opacity: 1;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .article-modal {
        border-radius: 0;
        margin: 0;
        max-height: 100%;
    }
    
    .article-form {
        padding: 20px;
    }
    
    .article-form .form-row {
        flex-direction: column;
    }
    
    .editor-toolbar {
        gap: 3px;
        padding: 10px;
    }
    
    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .manage-modal {
        border-radius: 0;
        max-height: 100%;
    }
    
    .article-item {
        flex-direction: column;
    }
    
    .article-thumb {
        width: 100%;
        height: 120px;
    }
    
    .article-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .preview-article {
        padding: 20px;
    }
    
    .preview-title {
        font-size: 24px;
    }
}

/* Scrollbar */
.manage-content::-webkit-scrollbar,
.editor-content::-webkit-scrollbar {
    width: 6px;
}

.manage-content::-webkit-scrollbar-track,
.editor-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.manage-content::-webkit-scrollbar-thumb,
.editor-content::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 3px;
}
