/* My Content Page Styles */

.nav-section {
    margin: 20px 0;
    text-align: center;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1em;
}

.filter-form {
    width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #2c3e50;
    font-weight: 600;
    margin: 0;
}

/* Card Styles with Drag and Drop */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.content-card {
    position: relative;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: move;
    overflow: hidden;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.content-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: #667eea;
}

.content-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.content-card.drag-over {
    border-color: #3498db;
    background: #f0f8ff;
}

.card-cover {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: #f5f5f5;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 10px;
    background: #f8f9fa;
}

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

.btn-edit {
    padding: 4px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-edit:hover {
    background: #2980b9;
}

.btn-delete {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.3s;
}

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

.card-body {
    padding: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body h3 {
    margin-bottom: 12px;
    font-size: 1.2em;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    font-weight: 600;
    color: #2c3e50;
}

.card-body h3 a {
    color: #2c3e50;
    text-decoration: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
    max-width: 100%;
    transition: color 0.3s;
}

.card-body h3 a:hover {
    color: #667eea;
}

.card-url {
    font-size: 0.85em;
    color: #667eea;
    margin-bottom: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.card-url a {
    color: #667eea;
    text-decoration: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: inline-block;
    max-width: 100%;
    border-bottom: 1px dotted #667eea;
    transition: all 0.3s;
}

.card-url a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.card-body p,
.card-body .description,
.card-body .ai-summary {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.6;
}

.description.truncated,
.ai-summary.truncated {
    max-height: 4.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.6em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-summary {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
    border-left: 3px solid #667eea;
}

.ai-summary strong {
    color: #667eea;
    display: block;
    margin-bottom: 6px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.extracted-content {
    margin-top: 12px;
    padding: 12px;
    background: #fff9e6;
    border-radius: 6px;
    border-left: 3px solid #f39c12;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.extracted-content strong {
    color: #e67e22;
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.extracted-content ul,
.extracted-content ol {
    margin-left: 20px;
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.extracted-content li {
    margin-bottom: 6px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #6c757d;
}

.date {
    color: #6c757d;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 35px;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close {
    color: #6c757d;
    float: right;
    font-size: 32px;
    font-weight: 300;
    position: absolute;
    right: 20px;
    top: 20px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f8f9fa;
}

.close:hover,
.close:focus {
    color: #2c3e50;
    background: #e9ecef;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.form-actions .btn-delete {
    margin-left: auto;
    margin-right: 0;
}

/* Category Manager Styles */
.category-manager {
    margin-top: 20px;
}

.category-list {
    margin-top: 30px;
}

.category-list h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.category-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.field-info {
    font-weight: normal;
    color: #666;
    font-size: 0.85em;
    font-style: italic;
    display: inline;
    margin-left: 5px;
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    min-height: 44px;
}

.category-list li span {
    font-weight: 500;
    color: #2c3e50;
}

.btn-delete-small {
    padding: 4px 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-delete-small:hover {
    background: #c0392b;
}

#currentCoverImage {
    margin-top: 10px;
}

#currentCoverImage img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Drag handle indicator */
.content-card::before {
    content: '⋮⋮';
    position: absolute;
    top: 10px;
    right: 10px;
    color: #bbb;
    font-size: 1.2em;
    line-height: 0.5;
    opacity: 0;
    transition: opacity 0.3s;
}

.content-card:hover::before {
    opacity: 1;
}

/* Responsive - Mobile Optimized */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 5% auto;
        padding: 20px 15px;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-header h2 {
        font-size: 1.3em;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .card-header {
        padding: 10px 12px;
    }
    
    .filter-form {
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .category-list {
        max-height: 300px;
    }
    
    .file-item {
        flex-wrap: wrap;
        padding: 8px;
    }
    
    .file-actions {
        flex-wrap: wrap;
        width: 100%;
        margin-top: 8px;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 15px 12px;
        margin: 2% auto;
    }
    
    .close {
        font-size: 28px;
        right: 15px;
        top: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    label {
        font-size: 0.9em;
    }
    
    textarea {
        min-height: 80px;
    }
    
    .field-info {
        font-size: 0.75em;
    }
    
    .card-url {
        font-size: 0.85em;
    }
}

/* File Management Styles */
.file-upload-area {
    margin-bottom: 15px;
}

.files-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    background: #f8f9fa;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s;
}

.file-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.file-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f0f0f0;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

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

.file-name {
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 12px;
    color: #666;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: #f0f0f0;
}

.btn-icon-delete:hover {
    background-color: #fee;
}

