/* Instagram Grid Widget Styles */
:root {
    --grid-columns: 3;
    --background-color: #ffffff;
    --grid-background: #fafafa;
    --text-color: #333333;
    --overlay-color: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: var(--text-color);
    margin: 20px 0;
}

.widget-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Widget header styling - clean like she.creates */

.widget-header {
    background: transparent;
    border-radius: 0;
    padding: 16px 0;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
    border-bottom: 1px solid #eee;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.widget-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.brand-text {
    font-size: 22px;
    font-weight: 500;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.refresh-icon {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.refresh-icon:hover {
    background: #f5f5f5;
    color: #333;
}

.refresh-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.refresh-icon svg.spinning {
    animation: spin 1s linear infinite;
}

/* logo + brand wrapper */
.widget-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* logo image styling */
.widget-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  padding: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.widget-logo:hover {
  transform: scale(1.05);
}

/* text styling */
.brand-text {
  font-size: 24px;
  font-weight: bold;
}

.brand-accent {
  color: #007bff; /* accent color */
}


.widget-branding {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.widget-branding .brand-accent {
    font-style: italic;
    color: #667eea;
}

.refresh-button {
    background: #e9ecef;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-button:hover {
    background: #dee2e6;
    transform: translateY(-1px);
}

.refresh-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.refresh-button svg.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.widget-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
    display: none;
}

.instagram-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns), 1fr);
    gap: 4px;
    background-color: #ffffff;
    padding: 0;
    margin: 0;
    
}

.grid-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: #f8f9fa;
    
   aspect-ratio: 3 / 4;
}

/* Image container for lazy loading */
.grid-item-image {
    width: 100%;
    height: 100%;
    position: relative;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
    background-color: #f0f0f0;
    opacity: 0;
    transition: opacity .25s ease;
}

.grid-item.loaded img {
    opacity: 1;
}

/* Placeholder while loading */
.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: #999;
    font-size: 12px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Error state */
.image-error {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffe6e6;
    font-size: 36px;
    opacity: 0.5;
}

/* Date badge - positioned in top-left with more spacing */
.date-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 10;
    backdrop-filter: blur(10px);
    max-width: 60px;
    text-align: center;
   
}



/* Content type icons - exactly positioned like Instagram */
.content-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    color: white;
    font-size: 18px;
    z-index: 10;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Text overlay - matching she.creates gradient and positioning */
.text-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
    color: white;
    padding: 40px 12px 12px 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    z-index: 5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.text-overlay{
    display: none;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #e74c3c;
    font-size: 16px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.post-date {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

/* Medium screens (tablets) */
@media (max-width: 768px) and (min-width: 481px) {
    .date-badge {
        top: 7px;
        left: 7px;
        font-size: 11px;
        max-width: 55px;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .widget-container {
        padding: 10px;
    }
    
    .instagram-grid {
        gap: 2px;
    }
    
    /* Ensure proper spacing on mobile */
    .date-badge {
        top: 6px;
        left: 6px;
        font-size: 11px;
        padding: 3px 6px;
        max-width: 50px;
    }
}

/* Embed styles for Notion */
.embed-mode {
    padding: 0;
    max-width: none;
}

.embed-mode .widget-container {
    padding: 0;
    max-width: none;
}

.embed-mode .instagram-grid {
    border-radius: 0;
}

/* Setup Help Styles */
.setup-help {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.setup-help h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.setup-help p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.setup-help ol {
    margin: 20px 0;
    padding-left: 20px;
}

.setup-help li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.setup-help code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
}




/* Top Navigation (above grid) */
.widget-nav {
  display: flex;
  justify-content: space-between; /* left, center, right layout */
  align-items: center;
  padding: 0px 30px 20px 30px;
  border-bottom: 2px solid #eee8e1; /* only bottom border */
}

.nav-item {
  position: relative;
  font-size: 22px; /* smaller icon size */
  color: #b3a9a9;
  cursor: pointer;
  transition: color 0.3s ease;
}

.nav-item.active {
  color: #2b0c0c; /* active icon color */
}

.nav-item.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 2px;
  background-color: #2b0c0c;
  border-radius: 2px;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  color: #8e8e8e;
}

.nav-item.active svg {
  color: #000;
}

.nav-item:hover {
  color: #000; 
}