
/* Main Container Layout */
.tg-main-container {
  display: flex;
  min-height: calc(100vh - 80px);
  background: #f8fafc;
  position: relative;
  margin-top: 5.8rem;
}

/* Professional Sidebar - FIXED */
.tg-sidebar {
  width: 280px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 80px;
  margin-top: 1rem;
  left: 0;
  height: calc(100vh - 80px);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  z-index: 100;
}

.tg-sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  flex-shrink: 0;
}

.tg-sidebar-header h2 {
  font-size: 1.8rem;
  color: #ffffff;
  font-weight: 700;
  margin: 0;
}

.tg-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  background: transparent;
}

/* Navigation Items */
.tg-nav-item {
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  user-select: none;
  background: transparent;
  white-space: nowrap;
}

.tg-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.tg-nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-left-color: #ffffff;
}

.tg-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Content Area - Offset for fixed sidebar */
.tg-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: #f8fafc;
  margin-left: 280px;
  min-height: calc(100vh - 80px);
}

.tg-content-header {
  margin-bottom: 2rem;
}

.tg-content-header h1 {
  font-size: 1.875rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.tg-content-header p {
  color: #64748b;
  font-size: 1rem;
  margin: 0;
}

.tg-view-content {
  display: block;
}

.tg-view-content.hidden {
  display: none !important;
}

/* Templates Grid (Letter Templates) */
.tg-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.5rem;
}

.tg-template {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

.tg-template:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  border-color: #cbd5e1;
}

.tg-template-title {
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  margin: 0;
  background: #fafafa;
}

.tg-letter-container {
  padding: 2rem;
  background: white;
  min-height: 300px;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #334155;
}


 /* Canva Templates Grid - Enhanced */
  .tg-canva-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
  }

  /* Canva Card - Premium Design */
  .tg-canva-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
  }

  .tg-canva-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(-8px);
    border-color: #e5e7eb;
  }

  /* Canva Preview - Image Container */
  .tg-canva-preview-container {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  }

  .tg-canva-preview {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
  }

  .tg-canva-card:hover .tg-canva-preview {
    transform: scale(1.02);
  }

  /* Badge for Canva */
  .tg-canva-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(99, 102, 241, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 10;
  }

  /* Canva Footer - Premium Button */
  .tg-canva-footer {
    padding: 1.5rem;
    background: #fafafa;
    border-top: 1px solid #f1f5f9;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.75rem;
  }

  .tg-canva-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    text-align: left;
  }

  /* Canva Button - Enhanced */
  .tg-canva-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
  }

  .tg-canva-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  }

  .tg-canva-btn:active {
    transform: translateY(0);
  }

  .tg-canva-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Responsive Design */
  @media (max-width: 1200px) {
    .tg-canva-grid {
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 1.5rem;
    }
  }

  @media (max-width: 768px) {
    .tg-canva-grid {
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 1.25rem;
    }

    .tg-canva-preview-container {
      height: 240px;
    }

    .tg-canva-footer {
      padding: 1rem;
    }

    .tg-canva-title {
      font-size: 0.95rem;
    }

    .tg-canva-btn {
      padding: 0.75rem 0.875rem;
      font-size: 0.9rem;
    }
  }

  @media (max-width: 480px) {
    .tg-canva-grid {
      grid-template-columns: 1fr;
    }

    .tg-canva-preview-container {
      height: 200px;
    }
  }
/* Responsive Design */
@media (max-width: 1200px) {
  .tg-templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 1024px) {
  .tg-sidebar {
    width: 260px;
  }

  .tg-content-area {
    margin-left: 260px;
  }

  .tg-templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .tg-main-container {
    flex-direction: column;
  }

  .tg-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    left: 0;
  }

  .tg-content-area {
    margin-left: 0;
    min-height: auto;
  }

  .tg-sidebar-nav {
    display: flex;
    overflow-x: auto;
    padding: 0;
  }

  .tg-nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .tg-nav-item.active {
    border-left: none;
    border-bottom-color: #0284c7;
  }

  .tg-content-area {
    padding: 1.5rem 1rem;
  }

  .tg-templates-grid {
    grid-template-columns: 1fr;
  }

  .tg-content-header h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .tg-sidebar-header {
    padding: 1rem;
  }

  .tg-nav-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .tg-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .tg-template-title {
    font-size: 1rem;
    padding: 0.875rem 1rem;
  }

  .tg-letter-container {
    padding: 1.5rem 1rem;
    font-size: 0.875rem;
  }


}

/* Saved Highlight Animation */
.tg-saved-highlight {
  animation: tgHighlightFlash 0.6s ease;
}

@keyframes tgHighlightFlash {
  0% {
    background-color: #d1fae5;
  }
  100% {
    background-color: white;
  }
}

/* Scrollbar Styling */
.tg-sidebar-nav::-webkit-scrollbar,
.tg-content-area::-webkit-scrollbar {
  width: 8px;
}

.tg-sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.tg-content-area::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.tg-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.tg-content-area::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.tg-sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.tg-content-area::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.delete-btn {
  padding: 0.625rem 1.25rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.delete-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.delete-btn svg {
  width: 16px;
  height: 16px;
}