/**
 * Sprint 8: Enhanced Portfolio Gallery CSS
 * Bahrain Skills Platform
 */

/* Portfolio Gallery Page */
.portfolio-gallery-page {
    padding: 30px 0;
}

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

.portfolio-gallery-header h2 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.portfolio-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.portfolio-filters select,
.portfolio-filters input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

.portfolio-filters input[type="search"] {
    min-width: 250px;
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Portfolio Card */
.portfolio-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.portfolio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.portfolio-card-image-link {
    display: block;
    text-decoration: none;
}

.portfolio-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
}

.portfolio-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-card:hover .portfolio-card-image img {
    transform: scale(1.05);
}

.portfolio-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 15px;
}

.portfolio-card:hover .portfolio-card-overlay {
    opacity: 1;
}

.portfolio-card-stats {
    display: flex;
    gap: 15px;
    color: #fff;
    font-size: 13px;
}

.portfolio-card-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.portfolio-card-body {
    padding: 20px;
}

.portfolio-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.portfolio-card-title a {
    color: inherit;
    text-decoration: none;
}

.portfolio-card-title a:hover {
    color: #E60026;
}

.portfolio-card-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.portfolio-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.portfolio-tag {
    background: #fff0f1;
    color: #E60026;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.portfolio-card-author {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.portfolio-card-author img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.portfolio-card-author-info {
    flex: 1;
}

.portfolio-card-author-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.portfolio-card-author-name a {
    color: inherit;
    text-decoration: none;
}

.portfolio-card-author-name a:hover {
    color: #E60026;
}

.portfolio-card-author-rating {
    font-size: 12px;
    color: #f39c12;
}

/* Portfolio Detail Page */
.portfolio-detail {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.portfolio-detail-header {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.portfolio-detail-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.portfolio-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.portfolio-detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Portfolio Gallery Lightbox */
.portfolio-gallery {
    padding: 30px;
}

.portfolio-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.portfolio-gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: #f5f5f5;
}

.portfolio-gallery-item img,
.portfolio-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.portfolio-gallery-item:hover img,
.portfolio-gallery-item:hover video {
    transform: scale(1.05);
}

.portfolio-gallery-item .item-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Portfolio Gallery Images Grid */
.portfolio-gallery-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px 0;
    margin-bottom: 20px;
}

.gallery-image {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.gallery-image:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-image:hover img {
    transform: scale(1.05);
}

.gallery-image .cover-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f39c12 0%, #e74c3c 100%);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.no-images {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px dashed #ddd;
}

.no-images i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
    display: block;
}

.no-images p {
    color: #999;
    margin: 0;
}

/* Portfolio Description */
.portfolio-description {
    padding: 30px;
    border-top: 1px solid #eee;
}

.portfolio-description h4 {
    color: #333;
    font-weight: 600;
    margin-bottom: 15px;
}

.portfolio-description p {
    color: #555;
    line-height: 1.7;
}

/* Stats Grid in Sidebar */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-item i {
    font-size: 24px;
    color: #999;
    transition: all 0.3s ease;
}

.stat-item i:hover {
    transform: scale(1.1);
}

.stat-item i.liked,
.stat-item i.fas.fa-heart {
    color: #e74c3c !important;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.stat-label {
    font-size: 12px;
    color: #999;
}

/* Portfolio Actions */
.portfolio-actions {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.portfolio-action-btn {
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.portfolio-action-btn.like-btn {
    background: #fff;
    border: 2px solid #e74c3c;
    color: #e74c3c;
}

.portfolio-action-btn.like-btn:hover,
.portfolio-action-btn.like-btn.liked {
    background: #e74c3c;
    color: #fff;
}

.portfolio-action-btn.share-btn {
    background: #f5f5f5;
    color: #333;
}

.portfolio-action-btn.share-btn:hover {
    background: #e9e9e9;
}

/* Comments Section */
.portfolio-comments {
    padding: 30px;
    border-top: 1px solid #eee;
}

.portfolio-comments h4 {
    color: #333;
    font-weight: 600;
    margin-bottom: 20px;
}

.comment-form {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.comment-form textarea {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    height: 80px;
}

.comment-form button {
    align-self: flex-end;
    padding: 10px 25px;
    background: #E60026;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.comment-form button:hover {
    background: #CC0022;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    display: flex;
    gap: 12px;
}

.comment-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
}

.comment-author {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
}

.comment-text {
    color: #555;
    font-size: 14px;
    margin-bottom: 8px;
}

.comment-time {
    font-size: 12px;
    color: #999;
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.comment-date {
    font-size: 12px;
    color: #999;
}

.btn-delete-comment {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-delete-comment:hover {
    opacity: 1;
}

.no-comments {
    color: #999;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.login-to-comment {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.login-to-comment a {
    color: #E60026;
    text-decoration: none;
}

.login-to-comment a:hover {
    text-decoration: underline;
}

/* Portfolio Form */
.portfolio-form {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.portfolio-form h3 {
    color: #333;
    font-weight: 600;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* File Upload Zone */
.file-upload-zone {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: #E60026;
    background: #fff0f1;
}

.file-upload-zone i {
    font-size: 48px;
    color: #999;
    margin-bottom: 15px;
}

.file-upload-zone p {
    color: #666;
    margin-bottom: 10px;
}

.file-upload-zone span {
    font-size: 13px;
    color: #999;
}

/* Upload Preview */
.upload-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.upload-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.upload-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.upload-preview-item .set-cover-btn {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    border: none;
}

.upload-preview-item.is-cover {
    border: 3px solid #E60026;
}

/* Upload Progress */
.upload-progress {
    margin-top: 10px;
}

.upload-progress-bar {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-bar .progress {
    height: 100%;
    background: linear-gradient(135deg, #E60026 0%, #B8001F 100%);
    transition: width 0.3s;
}

/* Tag Input */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-height: 50px;
}

.tag-input-container .tag {
    background: #E60026;
    color: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-input-container .tag button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

.tag-input-container input {
    flex: 1;
    min-width: 100px;
    border: none;
    padding: 5px;
    outline: none;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.tag-suggestions.show {
    display: block;
}

.tag-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.tag-suggestion-item:hover {
    background: #f5f5f5;
}

/* Empty State */
.portfolio-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.portfolio-empty i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #ddd;
}

.portfolio-empty h4 {
    color: #666;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-gallery-images {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .portfolio-detail-header {
        padding: 20px;
    }

    .portfolio-detail-title {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .portfolio-gallery-images {
        grid-template-columns: 1fr;
    }
}

/* RTL Support */
[dir="rtl"] .portfolio-card-author {
    flex-direction: row-reverse;
}

[dir="rtl"] .comment-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .portfolio-card-stats {
    flex-direction: row-reverse;
}
