/* Frontend Stylesheet for Zebra Blog Grid */

/* Container and Reset */
.zbg-container {
    font-family: var(--zbg-font-family), system-ui, -apple-system, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.zbg-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Spinner and Loaders */
.zbg-loading-spinner-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 0;
    gap: 1rem;
}

.zbg-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--zbg-color-badge-bg);
    border-radius: 50%;
    animation: zbg-spin 1s linear infinite;
}

@keyframes zbg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.zbg-loading-spinner-wrapper p {
    color: var(--zbg-color-excerpt);
    font-size: 14px;
    font-weight: 500;
}

/* Category Filter Tabs */
.zbg-tabs-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
    width: 100%;
}

.zbg-tabs-wrapper {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.02);
    overflow-x: auto;
    scrollbar-width: none; /* Hide standard Firefox scrollbar */
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.zbg-tabs-wrapper::-webkit-scrollbar {
    display: none; /* Hide Chrome/Safari scrollbars */
}

.zbg-tab-btn {
    background: var(--zbg-color-tab-bg);
    color: var(--zbg-color-tab-text);
    border: 1px solid var(--zbg-color-card-border);
    padding: 0.6rem 1.2rem;
    font-size: var(--zbg-font-size-tab, 10px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    border-radius: 100px;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.zbg-tab-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.zbg-tab-btn.active {
    background: var(--zbg-color-tab-bg-active);
    color: var(--zbg-color-tab-text-active);
    border-color: var(--zbg-color-tab-bg-active);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Admin Add Post Button */
.zbg-admin-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.zbg-btn-add-post {
    background: var(--zbg-color-badge-bg);
    color: var(--zbg-color-badge-text);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 13px;
    font-weight: 600;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.zbg-btn-add-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    opacity: 0.95;
}

/* Cards Grid */
.zbg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    position: relative;
}

/* Skeleton Loading State */
.zbg-skeleton-card {
    background: var(--zbg-color-card-bg);
    border: 1px solid var(--zbg-color-card-border);
    border-radius: var(--zbg-border-radius);
    padding: 1.2rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    min-height: 200px;
}

.zbg-skeleton-image {
    width: 180px;
    height: 180px;
    background: #f0f2f5;
    border-radius: calc(var(--zbg-border-radius) - 6px);
    flex-shrink: 0;
    animation: zbg-shimmer 1.5s infinite linear;
}

.zbg-skeleton-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.zbg-skeleton-text {
    height: 12px;
    background: #f0f2f5;
    border-radius: 4px;
    animation: zbg-shimmer 1.5s infinite linear;
}

.zbg-skeleton-text.short { width: 40%; }
.zbg-skeleton-text.medium { width: 70%; }
.zbg-skeleton-text.long { width: 95%; }

@keyframes zbg-shimmer {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Blog Card Item */
.zbg-card {
    background: var(--zbg-color-card-bg);
    border: 1px solid var(--zbg-color-card-border);
    border-radius: var(--zbg-border-radius);
    padding: 1.2rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    position: relative;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 200px;
    text-decoration: none;
    color: inherit;
}

.zbg-card:hover {
    border-color: var(--zbg-color-card-border-hover);
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.06);
}

.zbg-card-image-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: calc(var(--zbg-border-radius) - 6px);
    overflow: hidden;
    flex-shrink: 0;
    background: #f8fafc;
}

.zbg-card-image {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.5s ease;
}

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

/* Category Badge Overlaid on Image */
.zbg-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--zbg-color-badge-bg);
    color: var(--zbg-color-badge-text);
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.06em;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Card Content Area */
.zbg-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 160px;
    gap: 0.6rem;
}

.zbg-card-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.zbg-card-meta svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.zbg-card-title {
    font-size: var(--zbg-font-size-title);
    color: var(--zbg-color-title);
    font-weight: 750;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    
    /* Multiline Clamp */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zbg-card-excerpt {
    font-size: var(--zbg-font-size-excerpt);
    color: var(--zbg-color-excerpt);
    line-height: 1.5;
    
    /* Multiline Clamp */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zbg-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.zbg-card-explore {
    color: var(--zbg-color-explore);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: opacity 0.2s ease;
}

.zbg-card-explore:hover {
    opacity: 0.85;
}

/* Frontend Admin Action Bar on Cards */
.zbg-admin-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 0.4rem;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.zbg-card:hover .zbg-admin-actions {
    opacity: 1;
}

.zbg-btn-icon {
    border: none;
    background: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    color: #4b5563;
}

.zbg-btn-icon:hover {
    transform: scale(1.1);
}

.zbg-btn-icon.edit:hover {
    color: #3b82f6;
}

.zbg-btn-icon.delete:hover {
    color: #ef4444;
}

.zbg-btn-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Pagination Control */
.zbg-pagination-container {
    margin-top: 3.5rem;
}

.zbg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
}

.zbg-page-btn {
    border: 1px solid var(--zbg-color-card-border);
    background: var(--zbg-color-pagination-bg);
    color: var(--zbg-color-pagination-text);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.zbg-page-btn:hover:not(.disabled):not(.active) {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

.zbg-page-btn.active {
    background: var(--zbg-color-pagination-bg-active);
    color: var(--zbg-color-pagination-text-active);
    border-color: var(--zbg-color-pagination-bg-active);
    box-shadow: 0 4px 10px rgba(255, 122, 0, 0.2);
}

.zbg-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.zbg-page-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.zbg-pagination-info {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
}

/* Admin CRUD Glassmorphism Modal */
.zbg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(12, 25, 44, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.zbg-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.zbg-modal {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.zbg-modal-overlay.active .zbg-modal {
    transform: translateY(0);
}

.zbg-modal-header {
    background: #f8fafc;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.zbg-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0c192c;
}

.zbg-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    display: flex;
    align-items: center;
}

.zbg-modal-close:hover {
    color: #ef4444;
}

.zbg-modal-body {
    padding: 1.5rem;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.zbg-form-group {
    margin-bottom: 1.25rem;
}

.zbg-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.zbg-form-control {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 14px;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.zbg-form-control:focus {
    outline: none;
    border-color: var(--zbg-color-badge-bg);
}

textarea.zbg-form-control {
    resize: vertical;
    min-height: 80px;
}

.zbg-modal-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.zbg-btn {
    padding: 0.6rem 1.2rem;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.zbg-btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.zbg-btn-secondary:hover {
    background: #cbd5e1;
}

.zbg-btn-primary {
    background: var(--zbg-color-badge-bg);
    color: var(--zbg-color-badge-text);
}

.zbg-btn-primary:hover {
    opacity: 0.95;
}

/* Toast Notifications */
.zbg-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999999;
}

.zbg-toast {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.zbg-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.zbg-toast.success { border-left: 4px solid #10b981; }
.zbg-toast.error { border-left: 4px solid #ef4444; }


/* Responsive Media Queries */
@media (max-width: 900px) {
    .zbg-grid {
        gap: 1.5rem;
    }
    .zbg-skeleton-card,
    .zbg-card {
        padding: 1rem;
        gap: 1rem;
    }
    .zbg-skeleton-image,
    .zbg-card-image-wrap {
        width: 140px;
        height: 140px;
    }
    .zbg-card-content {
        min-height: 130px;
    }
}

@media (max-width: 768px) {
    .zbg-grid {
        grid-template-columns: 1fr;
    }
    
    .zbg-tabs-container {
        justify-content: flex-start;
    }
    
    .zbg-tabs-wrapper {
        width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 480px) {
    .zbg-skeleton-card,
    .zbg-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .zbg-skeleton-image,
    .zbg-card-image-wrap {
        width: 100%;
        height: 200px;
    }
    
    .zbg-card-content {
        min-height: auto;
        gap: 0.75rem;
    }
    
    .zbg-card-footer {
        margin-top: 0.5rem;
    }
}
