/**
 * Kautilya Educational Academy - Blog/Achievements Styles
 * LinkedIn-style blog system
 */

/* ============================================
   ACHIEVEMENTS HERO
   ============================================ */
.achievements-hero {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2a4a7a 100%);
    position: relative;
    overflow: hidden;
}

.achievements-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4a84b' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* ============================================
   FILTER TABS
   ============================================ */
.filter-section {
    padding: var(--spacing-lg) 0;
    position: sticky;
    top: 80px;
    z-index: 100;
    background: var(--bg-light);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-tabs {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--primary-blue);
    background: transparent;
    color: var(--primary-blue);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-tab:hover {
    background: rgba(26, 54, 93, 0.1);
}

.filter-tab.active {
    background: var(--primary-blue);
    color: white;
}

/* ============================================
   BLOG FEED
   ============================================ */
.blog-feed {
    max-width: 700px;
    margin: 0 auto;
}

.loading-posts {
    text-align: center;
    padding: var(--spacing-2xl);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    margin: 0 auto var(--spacing-md);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-posts {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-light);
}

.no-posts-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

/* ============================================
   BLOG POST CARD
   ============================================ */
.blog-post {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.blog-post:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.blog-post.featured {
    border: 2px solid var(--primary-gold);
}

.featured-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-gold);
    color: var(--primary-blue);
    padding: 0.35rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0 var(--radius-lg) 0 var(--radius-md);
}

/* Post Header */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-lg);
    padding-bottom: 0;
}

.post-author {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.author-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-blue), #2a4a7a);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-name {
    font-weight: 600;
    color: var(--text-dark);
}

.post-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
}

.post-type {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Post Actions Menu */
.post-actions-menu {
    position: relative;
}

.post-menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-light);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.post-menu-btn:hover {
    background: var(--bg-light);
}

.post-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 150px;
    display: none;
    z-index: 100;
    overflow: hidden;
}

.post-menu-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.post-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.post-menu-dropdown button:hover {
    background: var(--bg-light);
}

/* Post Content */
.post-content {
    padding: var(--spacing-lg);
}

.post-title {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin-bottom: var(--spacing-md);
    line-height: 1.4;
}

.post-text {
    color: var(--text-body);
    line-height: 1.7;
}

/* Post Media */
.post-media {
    width: 100%;
    background: var(--bg-light);
}

.post-media img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.post-media img:hover {
    opacity: 0.95;
}

.post-media.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.post-media.video-container iframe,
.post-media video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Post Footer */
.post-footer {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--bg-light);
}

.like-btn,
.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-weight: 500;
}

.like-btn:hover,
.share-btn:hover {
    background: var(--bg-light);
}

.like-btn.liked {
    color: #e74c3c;
}

.like-btn.liked .like-icon {
    animation: heartBeat 0.5s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-toggle {
    position: fixed;
    bottom: 180px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0.3;
}

.admin-toggle:hover {
    opacity: 1;
    transform: scale(1.1);
}

.admin-panel {
    position: fixed;
    bottom: 240px;
    right: 20px;
    width: 280px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: var(--spacing-lg);
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.admin-header h3 {
    margin: 0;
    font-size: 1rem;
}

.close-admin {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
}

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.import-btn {
    cursor: pointer;
}

/* ============================================
   EDITOR MODAL
   ============================================ */
.editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--spacing-lg);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.editor-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--bg-light);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.editor-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-editor {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.post-form {
    padding: var(--spacing-lg);
}

.post-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.post-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.post-form input[type="text"],
.post-form input[type="date"],
.post-form select,
.post-form textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

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

/* Media Input */
.media-input {
    display: flex;
    gap: 0.5rem;
}

.media-input input {
    flex: 1;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    background: var(--primary-blue);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.3s ease;
}

.upload-btn:hover {
    background: #2a4a7a;
}

.image-preview {
    margin-top: var(--spacing-sm);
    height: 150px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    overflow: hidden;
}

.image-preview.has-image {
    height: auto;
    max-height: 300px;
}

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

/* Checkbox Group */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--bg-light);
}

/* ============================================
   IMAGE MODAL
   ============================================ */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: zoom-out;
    animation: fadeIn 0.3s ease;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary-blue);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 5000;
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .filter-tabs {
        gap: 0.5rem;
    }

    .filter-tab {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .blog-post {
        margin-left: calc(var(--spacing-md) * -1);
        margin-right: calc(var(--spacing-md) * -1);
        border-radius: 0;
    }

    .post-header,
    .post-content,
    .post-footer {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }

    .editor-modal {
        padding: 0;
        align-items: flex-end;
    }

    .editor-content {
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 95vh;
    }

    .admin-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 200px;
    }

    .admin-toggle {
        bottom: 150px;
    }
}
