/* Reset and base styles */
* {
    box-sizing: border-box;
  }

  .google-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
    flex-direction: column; 
  }
  
  .google-login-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background-color: #4285F4;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }
  
  .google-login-btn img {
    width: 20px;
    height: 20px;
  }
  
  .google-login-btn:hover {
    background-color: #357ae8;
  }
  
  .dashboard-container {
    display: flex;
    height: calc(100vh - 80px); /* Account for header height */
    margin: 0;
    padding: 0;
    background-color: #f9fafb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
  }

  .section-label {
    font-weight: 600;                  /* strong but not too heavy */
    font-size: 16px;                 /* slightly larger */
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #222;                       /* darker for contrast */
    letter-spacing: 1px;               /* cleaner spacing */
    position: relative;
    padding: 0.5rem 1rem;
    background: linear-gradient(90deg, #f9f9f9, #e8f0fe); /* soft gradient bg */
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);  /* subtle shadow */
  }

  /* Mobile compact section labels */
  @media (max-width: 768px) {
    .section-label {
      font-size: 12px;
      margin-bottom: 0.25rem;
      padding: 0.25rem 0.5rem;
      letter-spacing: 0.5px;
    }
  }

  .section-label:hover {
    background: linear-gradient(90deg, #e3f2fd, #bbdefb);
    transform: scale(1.02);
    transition: all 0.2s ease-in-out;
  }
  
  .bordered-box {
    border: 1px solid #ccc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
  }

  /* Mobile compact bordered boxes */
  @media (max-width: 768px) {
    .bordered-box {
      padding: 0.5rem;
      margin-bottom: 0.5rem;
      border-radius: 6px;
    }
  }
  
  .bordered-box .nav-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
  }
  
  .bordered-box .nav-item:last-child {
    margin-bottom: 0;
  }

  /* Mobile compact bordered box nav items */
  @media (max-width: 768px) {
    .bordered-box .nav-item {
      margin-bottom: 0.25rem;
    }
  }
  
  .sidebar {
    width: 256px;
    background-color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out;
    position: fixed;
    top: 80px; /* Account for header height */
    left: 0;
    height: calc(100vh - 80px);
    z-index: 20;
    overflow-y: auto;
  }

  /* Desktop collapsed sidebar state */
  .sidebar.collapsed {
    width: 64px;
  }

  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .nav-button span,
  .sidebar.collapsed .section-header,
  .sidebar.collapsed .section-label {
    display: none;
  }

  .sidebar.collapsed .nav-item,
  .sidebar.collapsed .nav-button {
    justify-content: center;
    align-items: center;
    padding: 8px;
    position: relative;
    margin: 2px 8px;
    border-radius: 6px;
  }

  .sidebar.collapsed .nav-item svg,
  .sidebar.collapsed .nav-button svg {
    margin: 0 !important;
    width: 16px !important;
    height: 16px !important;
  }

  .sidebar.collapsed .bordered-box,
  .sidebar.collapsed .label-box {
    border: none;
    padding: 2px;
    margin: 2px 0;
    background: transparent;
  }

  /* Tooltip styles for collapsed sidebar */
  .sidebar.collapsed .nav-item::after,
  .sidebar.collapsed .nav-button::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    margin-left: 12px;
    z-index: 1000;
    pointer-events: none;
  }

  .sidebar.collapsed .nav-item::before,
  .sidebar.collapsed .nav-button::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    margin-left: 6px;
    z-index: 1000;
    pointer-events: none;
  }

  .sidebar.collapsed .nav-item:hover::after,
  .sidebar.collapsed .nav-button:hover::after,
  .sidebar.collapsed .nav-item:hover::before,
  .sidebar.collapsed .nav-button:hover::before {
    opacity: 1;
    visibility: visible;
  }

  /* Collapse Section */
  .collapse-section {
    border-bottom: none;
    padding: 4px 12px;
  }

  /* Desktop collapse button - inherits from nav-item */
  .desktop-collapse-button.nav-item {
    display: none;
    justify-content: flex-end;
  }

  .desktop-collapse-button:hover {
    background: #f3f4f6;
    color: #374151;
  }

  .sidebar.collapsed .desktop-collapse-button .collapse-icon {
    display: none;
  }

  .sidebar.collapsed .desktop-collapse-button .expand-icon {
    display: block !important;
  }

  /* Mobile sidebar toggle */
  .mobile-menu-button {
    display: none;
    position: fixed;
    top: 24px;
    left: 20px;
    z-index: 10000;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-menu-button:hover {
    background: #f9fafb;
    box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.15);
  }

  .mobile-menu-button svg {
    width: 20px !important;
    height: 20px !important;
    color: #374151;
    margin: 0 !important;
  }
  
  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-overlay.open {
    display: block;
    opacity: 1;
  }

  /* Ensure overlay covers the visible area when sidebar is open */
  @media (max-width: 768px) {
    .mobile-overlay.open {
      backdrop-filter: blur(2px);
    }
  }
  
  /* Responsive breakpoints */
  @media (max-width: 768px) {
    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      height: 100vh;
      width: 75vw; /* 75% of viewport width instead of fixed 280px */
      max-width: 320px; /* Maximum width cap */
      min-width: 250px; /* Minimum width to ensure usability */
      transform: translateX(-100%);
      z-index: 10000;
      visibility: hidden;
      opacity: 0;
      transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
      padding-top: 80px; /* Account for header */
      overflow-y: auto;
      overflow-x: hidden;
    }

    /* Hide desktop collapse button on mobile */
    .collapse-section {
      display: none;
    }
    
    .sidebar.open {
      transform: translateX(0) !important;
      z-index: 10000 !important;
      visibility: visible !important;
      opacity: 1 !important;
    }
    
    /* More specific rule to ensure it works */
    #sidebar.open {
      transform: translateX(0) !important;
      z-index: 10000 !important;
      visibility: visible !important;
      opacity: 1 !important;
    }
    
    .mobile-menu-button {
      display: block !important;
    }
    
    .dashboard-container {
      display: block;
      height: calc(100vh - 80px);
    }

    .main-content {
      margin-left: 0 !important;
      width: 100% !important;
      padding: 0;
      overflow-x: hidden;
      position: relative;
      display: block;
    }
    
    .header {
      padding-left: 60px; /* Make room for mobile menu button */
    }

    /* Ensure sidebar is above main content on mobile */
    .sidebar {
      z-index: 10000 !important;
    }

    .sidebar.open {
      z-index: 10000 !important;
    }
  }
  
  @media (min-width: 769px) {
    .sidebar {
      position: fixed;
      transform: translateX(0);
    }
    
    /* Show desktop collapse button on desktop */
    .desktop-collapse-button.nav-item {
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
    
    /* Ensure mobile button stays hidden on desktop */
    .mobile-menu-button {
      display: none !important;
    }
    
    /* Reset any mobile-specific sidebar states */
    .sidebar.collapsed ~ .main-content {
      margin-left: 0;
      width: calc(100% - 64px);
    }
  }
  
  /* Tablet adjustments */
  @media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
      width: 220px;
    }
    
    .main-content {
      margin-left: 220px;
      width: calc(100% - 220px);
    }
    
    .sidebar.collapsed {
      width: 64px;
    }
    
    .desktop-collapse-button.nav-item {
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
    
    .sidebar.collapsed ~ .main-content {
      margin-left: 64px;
      width: calc(100% - 64px);
    }
    
    .content-container {
      max-width: 100%;
      padding: 0 16px;
    }
  }
  

  
  /* Navigation sections */
  .nav-section {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
  }

  /* Mobile compact nav sections */
  @media (max-width: 768px) {
    .nav-section {
      padding: 4px 8px;
      border-bottom: 1px solid #e5e7eb;
    }
  }
  
  .nav-item, .nav-button {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    text-decoration: none;
    color: #374151;
    border-radius: 6px;
    margin-bottom: 2px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
  }

  /* Mobile compact nav items */
  @media (max-width: 768px) {
    .nav-item, .nav-button {
      padding: 4px 8px;
      font-size: 12px;
      margin-bottom: 1px;
    }
  }
  
  .nav-item:hover, .nav-button:hover {
    background-color: #f3f4f6;
  }

  .nav-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
  }
  
  .section-header {
    padding: 0 12px;
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    margin-top: 4px;
  }

  /* Mobile compact section headers */
  @media (max-width: 768px) {
    .section-header {
      padding: 0 8px;
      font-size: 9px;
      margin-bottom: 2px;
      margin-top: 2px;
    }
  }
  
  /* Icon styles - FORCE small size */
  svg {
    width: 16px !important;
    height: 16px !important;
    margin-right: 8px !important;
    flex-shrink: 0 !important;
  }

  /* Mobile compact icons */
  @media (max-width: 768px) {
    svg {
      width: 14px !important;
      height: 14px !important;
      margin-right: 6px !important;
    }
  }
  
  .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* Main content */
  .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
    margin-left: 256px;
    width: calc(100% - 256px);
  }

  /* Adjust main content when sidebar is collapsed */
  .sidebar.collapsed ~ .main-content {
    margin-left: 64px;
    width: calc(100% - 64px);
  }
  
  .header {
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
  }
  
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .header-title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
    background-color: #d1d5db;
    border-radius: 50%;
  }
  
  .main-section {
    flex: 1;
    padding: 24px;
  }
  
  .content-container {
    max-width: 1024px;
    margin: 0 auto;
    width: 100%;
  }
  
  .welcome-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 24px;
  }
  
  .welcome-title {
    font-size: 18px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 16px;
  }
  
  .welcome-text {
    color: #6b7280;
  }
  
  /* Mobile responsive adjustments */
  @media (max-width: 640px) {
    .collapse-button-container {
      display: none; /* Hide completely on small screens */
    }
    
    .nav-section {
      padding: 2px 6px;
    }
    
    .nav-item, .nav-button {
      padding: 6px 8px;
      font-size: 12px; /* Smaller but still readable */
    }
    
    .section-header {
      font-size: 10px;
      padding: 0 8px;
      margin-bottom: 1px;
      margin-top: 1px;
    }

    .section-label {
      font-size: 11px;
      margin-bottom: 0.2rem;
      padding: 0.2rem 0.4rem;
    }

    .bordered-box {
      padding: 0.3rem;
      margin-bottom: 0.3rem;
    }
    
    .header {
      padding: 12px 16px;
    }
    
    .header-title {
      font-size: 20px;
    }
    
    .main-section {
      padding: 8px 0;
      overflow-y: auto;
      height: calc(100vh - 80px);
    }

    .content-container {
      max-width: 100%;
      margin: 0;
      padding: 0;
      width: 100%;
    }
    
    .welcome-card {
      padding: 16px;
    }
    
    .welcome-title {
      font-size: 16px;
    }
    
    .welcome-text {
      font-size: 14px;
    }
  }
  
  /* Very small screens */
  @media (max-width: 480px) {
    .sidebar {
      width: 85vw; /* 85% of viewport width on very small screens */
      max-width: 300px; /* Smaller max width for small screens */
      min-width: 240px; /* Smaller minimum width */
      padding-top: 70px; /* Reduced padding */
    }
    
    .header-title {
      font-size: 18px;
    }

    .mobile-menu-button {
      top: 20px;
      left: 16px;
      padding: 8px;
    }

    .mobile-menu-button svg {
      width: 18px !important;
      height: 18px !important;
    }

    /* Ultra compact for very small screens */
    .nav-section {
      padding: 1px 4px;
    }

    .nav-item, .nav-button {
      padding: 4px 6px;
      font-size: 11px;
      margin-bottom: 0px;
    }

    .section-label {
      font-size: 10px;
      margin-bottom: 0.1rem;
      padding: 0.15rem 0.3rem;
    }

    .bordered-box {
      padding: 0.2rem;
      margin-bottom: 0.2rem;
    }

    .section-header {
      font-size: 9px;
      margin-bottom: 0px;
      margin-top: 0px;
    }

    svg {
      width: 12px !important;
      height: 12px !important;
      margin-right: 4px !important;
    }
  }

  /* Extra small screens */
  @media (max-width: 360px) {
    .sidebar {
      width: 90vw; /* 90% of viewport width on extra small screens */
      max-width: 280px;
      min-width: 220px;
    }
  }

  /* Dashboard box */

  .main-heading {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    margin-top: 2rem;
    padding: 0.25rem 0;
  }
  
  .sub-heading {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0;
  }
  
  .chat-form {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
  }
  
  .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: #888;
    pointer-events: none;
    display: flex;
    align-items: center;
  }
  
  .search-icon svg {
    width: 50px;
    height: 50px;
  }

  .svg-margin {
    margin-left: 8px !important;
    margin-right: 0 !important;
  }
  
  .chat-input {
    flex: 1;
    padding: 0.75rem 3.5rem 0.75rem 2.5rem; /* extra left padding for icon */
    border-radius: 2rem;
    border: 1px solid #ccc;
    font-size: 1rem;
    box-sizing: border-box;
  }
  
  .send-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    height: 2.5rem;
    width: 2.5rem;
    padding: 0;
    border-radius: 2rem;
    background: #111;
    color: #fff;
    border: none;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .send-btn svg {
    width: 22px;
    height: 22px;
  }
  
  .box-row {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    margin-top: 2rem;
  }
  
  .info-box {
    flex: 1;
    background: #f9f9f9;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  
  .box-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
    margin-bottom: 0.75rem;
  }
  
  .box-text {
    font-size: 1rem;
    font-weight: 500;
  }

  /* Header box */

  .avatar-container {
    position: relative;
    display: inline-block;
  }
  
  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    object-fit: cover;
  }
  
  .menu {
    position: absolute;
    top: 110%; /* just below the avatar */
    right: 0;
    left: auto;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 12px 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 8px;
    margin-right: 3.4rem;
  }
  
  .menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  .menu li {
    width: 100%;
  }
  
  .menu a {
    display: block;
    padding: 10px 24px;
    color: #222;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.15s, color 0.15s;
  }
  
  .menu a:hover {
    background: #f3f4f6;
    color: #4f46e5;
  }
  
  /* Optional: Add a small caret/arrow above the menu */
  .menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 16px;
    left: auto;
    transform: none;
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
    filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.04));
  }
  
  .hidden {
    display: none;
  }

  /* Settings page */
  .plan-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }
  
  .plan-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
  }
  
  .plan-option input[type="radio"] {
    margin-top: 6px;
  }
  
  .plan-details h3 {
    margin: 0;
    font-size: 16px;
  }
  
  .plan-details p {
    margin: 4px 0 0;
    font-size: 14px;
    color: #555;
  }
  
  .btn-save-plan {
    margin-top: 20px;
    padding: 8px 16px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
  }

  .btn-class {
    background: #111;
    color: #fff;
    border: none;
    border-radius: 2rem;
    padding: 0.75rem 1.5rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 1.5rem;
    transition: background 0.2s, color 0.2s;
    display: block;
  }

  .btn-class:hover {
    background: #222;
    color: #fff;
  }

  /* Templates Styles */
  .templates-header {
    text-align: center;
    margin-bottom: 40px;
  }

  .templates-title {
    font-size: 32px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
    line-height: 1.2;
  }

  .templates-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  .search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
  }

  .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px !important;
    height: 20px !important;
    color: #9ca3af;
    margin-right: 0 !important;
  }

  .search-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    background-color: #f9fafb;
    transition: all 0.2s ease;
  }

  .search-input:focus {
    outline: none;
    border-color: #2563eb;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  .templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    justify-items: center;
  }

  .template-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 260px;
  }

  .template-card:hover {
    border-color: #2563eb;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }

  .template-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    position: relative;
  }

  .template-card:hover .template-icon {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  }

  .template-icon svg {
    width: 40px !important;
    height: 40px !important;
    color: #6b7280;
    margin-right: 0 !important;
  }

  .template-card:hover .template-icon svg {
    color: #2563eb;
  }

  .template-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
  }

  .template-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
  }

  /* Adjust template-icon for 9:16 video format */
  .template-icon:has(.template-preview-video) {
    width: 220px;
    height: 391px;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  .template-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
    line-height: 1.3;
  }

  .template-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0 0 8px 0;
  }

  .template-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
  }

  .template-cost {
    font-size: 16px;
    font-weight: 700;
    color: #059669;
  }

  .template-views {
    font-size: 13px;
    color: #6b7280;
  }

  /* Empty State */
  .empty-state {
    text-align: center;
    padding: 80px 20px;
    max-width: 400px;
    margin: 0 auto;
  }

  .empty-icon {
    width: 64px !important;
    height: 64px !important;
    color: #d1d5db;
    margin: 0 auto 24px !important;
  }

  .empty-title {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
  }

  .empty-description {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.5;
  }

     /* Responsive adjustments for templates */
   @media (max-width: 768px) {
     .templates-header {
       margin-bottom: 30px;
     }

     .templates-title {
       font-size: 24px;
     }

     .templates-subtitle {
       font-size: 14px;
       padding: 0 20px;
       line-height: 1.5;
     }

    .templates-grid {
      grid-template-columns: 1fr;
      gap: 20px;
      padding: 0 20px;
      max-width: 100%;
    }

    .template-card {
      padding: 18px;
      max-width: 100%;
      width: 100%;
    }

    .template-icon {
      width: 64px;
      height: 64px;
      margin-bottom: 14px;
    }

    .template-icon:has(.template-preview-video) {
      width: 200px;
      height: 356px;
    }

    .template-icon svg {
      width: 32px !important;
      height: 32px !important;
    }

    .template-name {
      font-size: 15px;
    }

    .template-cost {
      font-size: 15px;
    }

    .template-views {
      font-size: 12px;
    }

    .template-meta {
      padding-top: 8px;
      margin-top: 10px;
    }

    .search-container {
      padding: 0 20px;
    }
  }

     @media (max-width: 480px) {
     .templates-header {
       margin-bottom: 24px;
     }

     .templates-title {
       font-size: 20px;
     }

     .templates-subtitle {
       font-size: 13px;
       line-height: 1.4;
       padding: 0 16px;
     }

     .search-input {
       font-size: 14px;
       padding: 14px 14px 14px 44px;
     }

     .search-icon {
       left: 14px;
       width: 18px !important;
       height: 18px !important;
     }

    .templates-grid {
      padding: 0 16px;
      gap: 20px;
    }

    .template-card {
      padding: 16px;
      max-width: 100%;
    }

    .template-icon {
      width: 56px;
      height: 56px;
      margin-bottom: 12px;
    }

    .template-icon:has(.template-preview-video) {
      width: 180px;
      height: 320px;
    }

    .template-icon svg {
      width: 28px !important;
      height: 28px !important;
    }

    .template-name {
      font-size: 14px;
      margin-bottom: 4px;
    }

    .template-cost {
      font-size: 14px;
    }

    .template-views {
      font-size: 11px;
    }

    .template-meta {
      padding-top: 6px;
      margin-top: 8px;
    }
   }

   /* Extra small devices (phones, 375px and down) */
   @media (max-width: 375px) {
     .templates-grid {
       padding: 0 12px;
     }

     .template-card {
       padding: 14px;
     }

     .template-icon:has(.template-preview-video) {
       width: 160px;
       height: 284px;
     }

     .template-name {
       font-size: 13px;
     }

     .template-cost {
       font-size: 13px;
     }

     .template-views {
       font-size: 10px;
     }
   }

   /* Template Card Links */
   .template-card-link {
     text-decoration: none;
     color: inherit;
     display: block;
   }

   .template-card-link:hover {
     text-decoration: none;
     color: inherit;
   }

   /* New Three-Column Layout */
   .template-detail-container {
     display: flex;
     height: 100vh;
     background: #f8fafc;
     overflow: hidden;
   }

   .template-main-content {
     flex: 1;
     display: flex;
     flex-direction: column;
     overflow: hidden;
   }

   /* Top Header */
   .template-header {
     background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
     color: white;
     padding: 16px 24px;
     border-bottom: 1px solid #e2e8f0;
   }

   .header-content {
     display: flex;
     justify-content: space-between;
     align-items: center;
     max-width: 1400px;
     margin: 0 auto;
   }

   .title-section {
     display: flex;
     align-items: center;
     gap: 16px;
   }

   .template-title {
     font-size: 24px;
     font-weight: 600;
     margin: 0;
   }

   .badges {
     display: flex;
     gap: 8px;
   }

   .type-badge {
     background: rgba(255, 255, 255, 0.2);
     backdrop-filter: blur(10px);
     color: white;
     padding: 4px 12px;
     border-radius: 12px;
     font-size: 12px;
     font-weight: 600;
     border: 1px solid rgba(255, 255, 255, 0.3);
   }

   .difficulty-badge {
     background: rgba(255, 255, 255, 0.1);
     backdrop-filter: blur(10px);
     color: rgba(255, 255, 255, 0.9);
     padding: 4px 12px;
     border-radius: 12px;
     font-size: 12px;
     font-weight: 500;
     border: 1px solid rgba(255, 255, 255, 0.2);
   }

   .mini-workflow {
     background: rgba(255, 255, 255, 0.1);
     backdrop-filter: blur(10px);
     padding: 8px 16px;
     border-radius: 12px;
     border: 1px solid rgba(255, 255, 255, 0.2);
   }

   .workflow-text {
     font-size: 14px;
     color: rgba(255, 255, 255, 0.9);
   }

     /* Three Column Layout */
  .three-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 80px);
    gap: 0;
    transition: grid-template-columns 0.3s ease;
  }

  .three-column-layout.no-inputs {
    grid-template-columns: 1fr; /* Single column when no inputs required */
  }

  .three-column-layout.no-inputs.with-chat {
    grid-template-columns: 1fr 1fr; /* 2 columns when chat is active and no inputs */
  }

  .three-column-layout.with-chat {
    grid-template-columns: 1fr 1fr 1fr;
  }

   /* Column Styles */
   .column-title {
     font-size: 18px;
     font-weight: 600;
     color: #1e293b;
     margin-bottom: 20px;
     text-align: center;
   }

   /* Column 1: Input Selection */
   .input-column {
     background: white;
     padding: 24px;
     border-right: 1px solid #e2e8f0;
     overflow-y: auto;
   }

   .section-subtitle {
     font-size: 16px;
     font-weight: 600;
     color: #1e293b;
     margin-bottom: 16px;
   }

   .styles-section {
     margin-bottom: 24px;
   }

   /* OR Divider */
   .or-divider {
     display: flex;
     align-items: center;
     margin: 32px 0;
     position: relative;
   }

   .or-line {
     flex: 1;
     height: 1px;
     background: linear-gradient(90deg, transparent 0%, #e2e8f0 20%, #e2e8f0 80%, transparent 100%);
   }

   .or-text {
     padding: 0 16px;
     font-size: 14px;
     font-weight: 600;
     color: #64748b;
     background: white;
     position: relative;
     z-index: 1;
   }

     .custom-prompt-section {
    margin-bottom: 20px;
  }

  /* Single column layout adjustments */
  .three-column-layout.no-inputs .input-column {
    display: flex;
    flex-direction: column;
  }

  .three-column-layout.no-inputs .generate-section {
    margin-top: auto;
    padding-top: 32px;
  }

   .styles-grid {
     display: grid;
     grid-template-columns: repeat(2, 1fr);
     gap: 12px;
   }

   .style-card {
     background: white;
     border: 2px solid #e2e8f0;
     border-radius: 8px;
     overflow: hidden;
     cursor: pointer;
     transition: all 0.2s ease;
     position: relative;
   }

   .style-card:hover {
     border-color: #3b82f6;
     transform: translateY(-1px);
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
   }

   .style-card.selected {
     border-color: #3b82f6;
     background: #eff6ff;
   }

   .style-preview {
     position: relative;
     height: 80px;
     overflow: hidden;
   }

   .style-image,
   .style-video {
     width: 100%;
     height: 100%;
     object-fit: cover;
   }

   .style-icon {
     width: 100%;
     height: 100%;
     display: flex;
     align-items: center;
     justify-content: center;
     background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
     color: #64748b;
   }

   .style-icon svg {
     width: 24px !important;
     height: 24px !important;
     margin: 0 !important;
   }

   .style-check {
     position: absolute;
     top: 6px;
     right: 6px;
     width: 20px;
     height: 20px;
     background: #3b82f6;
     color: white;
     border-radius: 50%;
     display: flex;
     align-items: center;
     justify-content: center;
     font-size: 10px;
     font-weight: bold;
     opacity: 0;
     transition: opacity 0.2s ease;
   }

   .style-card.selected .style-check {
     opacity: 1;
   }

   .style-name {
     padding: 8px;
     font-size: 12px;
     font-weight: 600;
     color: #1e293b;
     margin: 0;
     text-align: center;
   }

   /* Modern Section Headers */
   .modern-section-title {
     font-size: 32px;
     font-weight: 700;
     color: #1e293b;
     margin-bottom: 8px;
     text-align: center;
   }

   .section-description {
     font-size: 16px;
     color: #64748b;
     text-align: center;
     margin-bottom: 48px;
   }

   /* Modern Workflow Section */
   .modern-workflow {
     padding: 80px 40px;
     max-width: 1200px;
     margin: 0 auto;
   }

   .workflow-header {
     text-align: center;
     margin-bottom: 60px;
   }

   .workflow-steps {
     display: flex;
     gap: 40px;
     align-items: flex-start;
   }

   .modern-step {
     flex: 1;
     position: relative;
   }

   .step-indicator {
     display: flex;
     align-items: center;
     margin-bottom: 24px;
   }

   .step-circle {
     width: 48px;
     height: 48px;
     background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
     color: white;
     border-radius: 50%;
     display: flex;
     align-items: center;
     justify-content: center;
     font-weight: 700;
     font-size: 18px;
     box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
     position: relative;
     z-index: 2;
   }

   .step-line {
     flex: 1;
     height: 2px;
     background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
     margin-left: 20px;
   }

   .modern-step:last-child .step-line {
     display: none;
   }

   .step-card {
     background: white;
     border-radius: 16px;
     padding: 32px 24px;
     box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
     border: 1px solid #e2e8f0;
     transition: all 0.3s ease;
     text-align: center;
   }

   .step-card:hover {
     transform: translateY(-4px);
     box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
   }

   .step-icon {
     width: 56px;
     height: 56px;
     background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
     border-radius: 16px;
     display: flex;
     align-items: center;
     justify-content: center;
     margin: 0 auto 20px;
     color: #3b82f6;
   }

   .step-icon svg {
     width: 28px !important;
     height: 28px !important;
     margin: 0 !important;
   }

   .step-card h3 {
     font-size: 20px;
     font-weight: 600;
     color: #1e293b;
     margin-bottom: 12px;
   }

   .step-card p {
     color: #64748b;
     line-height: 1.6;
     margin: 0;
     font-size: 15px;
   }

   /* Column 2: Create & Generate */
   .create-column {
     background: #f8fafc;
     padding: 24px;
     border-right: 1px solid #e2e8f0;
     overflow-y: auto;
     display: flex;
     flex-direction: column;
   }

     .create-column .generate-section {
    margin-top: auto;
    padding-top: 20px;
  }

   .custom-prompt-input {
     width: 100%;
     padding: 16px;
     border: 2px solid #e2e8f0;
     border-radius: 12px;
     font-size: 14px;
     resize: vertical;
     min-height: 80px;
     transition: all 0.2s ease;
     background: white;
     font-family: inherit;
   }

   .custom-prompt-input:focus {
     outline: none;
     border-color: #3b82f6;
     box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
   }

   .custom-prompt-input::placeholder {
     color: #9ca3af;
   }

   /* Selection States */
   .input-column .style-card.selected {
     border-color: #3b82f6;
     background: #eff6ff;
     box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
   }

   .custom-prompt-input.active {
     border-color: #3b82f6;
     box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
   }

   /* Column 3: Chat */
   .chat-column {
     background: white;
     display: flex;
     flex-direction: column;
     overflow: hidden;
     border-left: 1px solid #e2e8f0;
   }

   .chat-header {
     padding: 16px 20px;
     border-bottom: 1px solid #e2e8f0;
     display: flex;
     justify-content: space-between;
     align-items: center;
   }

   .chat-actions {
     display: flex;
     gap: 8px;
   }

   .expand-chat-btn {
     background: none;
     border: none;
     padding: 6px;
     cursor: pointer;
     color: #6b7280;
     border-radius: 4px;
     transition: all 0.2s ease;
   }

   .expand-chat-btn:hover {
     background: #f3f4f6;
     color: #374151;
   }

   .expand-chat-btn svg {
     width: 16px !important;
     height: 16px !important;
     margin: 0 !important;
   }

   .chat-content {
     flex: 1;
     overflow-y: auto;
     padding: 16px;
   }

   .generation-summary {
     background: #f1f5f9;
     border-radius: 8px;
     padding: 12px;
     margin-bottom: 16px;
     border-left: 4px solid #3b82f6;
   }

   .generation-summary h4 {
     font-size: 14px;
     font-weight: 600;
     color: #1e293b;
     margin: 0 0 8px 0;
   }

   .summary-details {
     font-size: 12px;
     color: #64748b;
   }

   .summary-details > div {
     margin-bottom: 4px;
   }

   .chat-messages {
     flex: 1;
   }

   .welcome-message {
     display: flex;
     gap: 12px;
     margin-bottom: 16px;
   }

   .assistant-avatar {
     width: 32px;
     height: 32px;
     border-radius: 50%;
     background: #f3f4f6;
     display: flex;
     align-items: center;
     justify-content: center;
     font-size: 16px;
     flex-shrink: 0;
   }

   .message-content {
     flex: 1;
     background: #f8fafc;
     padding: 12px;
     border-radius: 12px;
     border: 1px solid #e2e8f0;
   }

   .message-content p {
     margin: 0;
     font-size: 14px;
     color: #374151;
     line-height: 1.5;
   }

   .chat-input-section {
     padding: 16px;
     border-top: 1px solid #e2e8f0;
   }

   .chat-input-container {
     display: flex;
     gap: 8px;
   }

   .chat-input {
     flex: 1;
     padding: 8px 12px;
     border: 1px solid #d1d5db;
     border-radius: 8px;
     font-size: 14px;
     transition: all 0.2s ease;
   }

   .chat-input:focus {
     outline: none;
     border-color: #3b82f6;
     box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
   }

   .chat-input:disabled {
     background: #f9fafb;
     color: #9ca3af;
     cursor: not-allowed;
   }

   .send-chat-btn {
     background: #3b82f6;
     color: white;
     border: none;
     padding: 8px;
     border-radius: 8px;
     cursor: pointer;
     display: flex;
     align-items: center;
     justify-content: center;
     transition: all 0.2s ease;
   }

   .send-chat-btn:hover:not(:disabled) {
     background: #2563eb;
   }

   .send-chat-btn:disabled {
     background: #9ca3af;
     cursor: not-allowed;
   }

   .send-chat-btn svg {
     width: 16px !important;
     height: 16px !important;
     margin: 0 !important;
   }

   /* Chat Message Styles */
   .message-bubble {
     margin-bottom: 16px;
   }

   .assistant-message {
     display: flex;
     gap: 12px;
     align-items: flex-start;
   }

     .message-wrapper.user-message {
    display: flex;
    justify-content: flex-end !important;
    flex-direction: row-reverse !important;
  }

     .user-bubble {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    max-width: 80%;
  }

  .user-bubble .message-header {
    color: #64748b !important;
  }

  .user-bubble p {
    color: #1e293b !important;
  }

   .message-header {
     display: flex;
     justify-content: space-between;
     margin-bottom: 4px;
     font-size: 11px;
     color: #6b7280;
   }

   .message-author {
     font-weight: 500;
   }

   .message-time {
     opacity: 0.7;
   }

   /* Generation Panel */
   .panel-header {
     padding: 24px;
     border-bottom: 1px solid #e5e7eb;
     display: flex;
     justify-content: space-between;
     align-items: center;
   }

   .panel-header h3 {
     font-size: 18px;
     font-weight: 600;
     color: #111827;
     margin: 0;
   }

   .close-panel {
     background: none;
     border: none;
     padding: 8px;
     cursor: pointer;
     color: #6b7280;
     border-radius: 6px;
   }

   .close-panel:hover {
     background: #f3f4f6;
     color: #111827;
   }

   .close-panel svg {
     width: 20px !important;
     height: 20px !important;
     margin: 0 !important;
   }

   .panel-content {
     flex: 1;
     padding: 24px;
     overflow-y: auto;
   }

   /* Upload Section */
   .upload-section {
     margin-bottom: 24px;
   }

     .upload-section h4 {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
  }

     .upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

   .upload-area:hover {
     border-color: #2563eb;
   }

   .upload-area.dragover {
     border-color: #2563eb;
     background: #eff6ff;
   }

     .upload-placeholder svg {
    width: 32px !important;
    height: 32px !important;
    color: #9ca3af;
    margin: 0 auto 8px !important;
  }

  .upload-placeholder p {
    font-size: 14px;
    color: #374151;
    margin-bottom: 2px;
    font-weight: 500;
  }

  .upload-placeholder span {
    font-size: 12px;
    color: #6b7280;
  }

   .uploaded-files {
     margin-top: 16px;
   }

   .uploaded-file {
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: 8px 12px;
     background: #f3f4f6;
     border-radius: 8px;
     margin-bottom: 8px;
   }

   .uploaded-file:last-child {
     margin-bottom: 0;
   }

   .file-info {
     display: flex;
     align-items: center;
     gap: 8px;
   }

   .file-name {
     font-size: 14px;
     color: #374151;
   }

   .remove-file {
     background: none;
     border: none;
     color: #ef4444;
     cursor: pointer;
     padding: 4px;
   }

   /* Prompt Section */
   .prompt-section {
     margin-bottom: 24px;
   }

   .prompt-section h4 {
     font-size: 16px;
     font-weight: 600;
     color: #111827;
     margin-bottom: 12px;
   }

   .prompt-textarea {
     width: 100%;
     padding: 12px;
     border: 1px solid #d1d5db;
     border-radius: 8px;
     font-size: 14px;
     resize: vertical;
     min-height: 100px;
   }

   .prompt-textarea:focus {
     outline: none;
     border-color: #2563eb;
     box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
   }

   /* Generate Button */
     .generate-btn {
    width: auto;
    max-width: 240px;
    margin: 0 auto 24px auto;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s ease;
  }

   .generate-btn:hover {
     transform: translateY(-1px);
     box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
   }

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

   .generate-btn svg {
     width: 20px !important;
     height: 20px !important;
     margin: 0 !important;
   }

     .generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }

  .generate-btn.compact {
    width: auto;
    max-width: 280px;
    margin: 24px auto 0 auto;
    padding: 14px 20px;
    font-size: 15px;
  }

   /* Chat Section */
   .chat-section h4 {
     font-size: 16px;
     font-weight: 600;
     color: #111827;
     margin-bottom: 16px;
   }

   .chat-messages {
     height: 300px;
     overflow-y: auto;
     border: 1px solid #e5e7eb;
     border-radius: 8px;
     padding: 16px;
     margin-bottom: 16px;
     background: #f9fafb;
   }

   .chat-message {
     margin-bottom: 16px;
   }

   .chat-message:last-child {
     margin-bottom: 0;
   }

   .message-user {
     background: #2563eb;
     color: white;
     padding: 8px 12px;
     border-radius: 16px 16px 4px 16px;
     margin-left: 20%;
     font-size: 14px;
   }

   .message-ai {
     background: white;
     color: #374151;
     padding: 8px 12px;
     border-radius: 16px 16px 16px 4px;
     margin-right: 20%;
     font-size: 14px;
     border: 1px solid #e5e7eb;
   }

   .chat-input-container {
     display: flex;
     gap: 8px;
   }

   .chat-input {
     flex: 1;
     padding: 8px 12px;
     border: 1px solid #d1d5db;
     border-radius: 20px;
     font-size: 14px;
   }

   .chat-input:focus {
     outline: none;
     border-color: #2563eb;
   }

   .send-btn {
     background: #2563eb;
     color: white;
     border: none;
     padding: 8px;
     border-radius: 50%;
     cursor: pointer;
     display: flex;
     align-items: center;
     justify-content: center;
   }

   .send-btn svg {
     width: 16px !important;
     height: 16px !important;
     margin: 0 !important;
   }

   /* Responsive Design */
   @media (max-width: 1024px) {
     .generation-panel {
       width: 350px;
     }

     .template-hero {
       flex-direction: column;
       gap: 24px;
       text-align: center;
     }

     .template-hero-image {
       width: 100%;
       max-width: 400px;
     }

     .steps-container {
       flex-direction: column;
       gap: 24px;
     }
   }

   @media (max-width: 768px) {
     .template-detail-container {
       flex-direction: column;
       height: auto;
     }

     .template-content {
       max-width: 100%;
       padding: 16px;
     }

     .generation-panel {
       width: 100%;
       position: fixed;
       bottom: 0;
       right: 0;
       top: auto;
       height: 60vh;
       border-left: none;
       border-top: 1px solid #e5e7eb;
       transform: translateY(100%);
       transition: transform 0.3s ease;
     }

     .generation-panel.open {
       transform: translateY(0);
     }

     .template-title {
       font-size: 24px;
     }

     .styles-grid {
       grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
       gap: 16px;
     }
   }

   /* Animation for loading spinner */
   @keyframes spin {
     from { transform: rotate(0deg); }
     to { transform: rotate(360deg); }
   }

   .animate-spin {
     animation: spin 1s linear infinite;
   }

/* Required field indicator */
.required {
  color: #ef4444;
  font-weight: bold;
}

/* Upload section when required */
.upload-section h4 .required {
  margin-left: 4px;
}

/* Add visual emphasis to required upload sections */
.upload-section:has(.required) {
  border-left: 3px solid #ef4444;
  padding-left: 12px;
  border-radius: 4px 0 0 4px;
}

/* Generate button disabled state when required files not uploaded */
.generate-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.generate-btn:disabled:hover {
  background-color: #9ca3af;
}

/* Right Panel - Generation */
.right-panel {
  background: #f8fafc;
  padding: 32px 24px;
  overflow-y: auto;
}

  /* Upload Grid Layout */
  .uploads-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
  }

  /* Compact Upload Section */
  .upload-section {
    margin-bottom: 20px;
  }

  .uploads-grid .upload-section {
    margin-bottom: 0;
  }

.upload-section h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}

.upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.upload-area:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.upload-placeholder svg {
  width: 32px !important;
  height: 32px !important;
  color: #64748b;
  margin: 0 auto 8px !important;
}

.upload-placeholder p {
  font-size: 14px;
  color: #1e293b;
  margin-bottom: 2px;
  font-weight: 500;
}

.upload-placeholder span {
  font-size: 12px;
  color: #64748b;
}

/* Compact Prompt Section */
.prompt-section {
  margin-bottom: 24px;
}

.prompt-section h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
}

.prompt-textarea {
  width: 100%;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
  background: #ffffff;
}

.prompt-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Compact Generate Button */
.generate-btn {
  width: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.generate-btn svg {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

/* File Upload Improvements */
.uploaded-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #f3f4f6;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.file-info {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-weight: 500;
  color: #374151;
  font-size: 12px;
}

.file-size {
  font-size: 10px;
  color: #6b7280;
}

.remove-file-btn {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
}

.remove-file-btn:hover {
  background: #dc2626;
}

/* Scrollbar Styling */
.center-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
  width: 6px;
}

.center-panel::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track {
  background: transparent;
}

.center-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.center-panel::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Three-Column Layout Responsive Design */
@media (max-width: 1200px) {
  .three-column-layout {
    grid-template-columns: 280px 1fr;
  }
  
  .three-column-layout.no-inputs {
    grid-template-columns: 1fr;
  }
  
  .three-column-layout.no-inputs.with-chat {
    grid-template-columns: 1fr 320px;
  }
  
  .three-column-layout.with-chat {
    grid-template-columns: 280px 1fr 320px;
  }
  
  .styles-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .template-detail-container {
    height: auto;
    min-height: 100vh;
  }
  
  .three-column-layout,
  .three-column-layout.with-chat {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .input-column, .create-column, .chat-column {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .generate-btn.compact {
    width: 100%;
    max-width: none;
    margin: 16px 0;
  }
  
  .template-header {
    padding: 12px 16px;
  }
  
  .template-title {
    font-size: 20px;
  }
  
  .mini-workflow {
    padding: 6px 12px;
  }
  
  .workflow-text {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .title-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .styles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .input-column, .create-column, .chat-column {
    padding: 16px;
  }
  
  .style-preview {
    height: 60px;
  }

  .or-divider {
    margin: 24px 0;
  }

  .styles-section,
  .custom-prompt-section {
    margin-bottom: 16px;
  }

  .uploads-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 480px) {
  .styles-grid {
    grid-template-columns: 1fr;
  }
  
  .badges {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .style-option-toggle {
    flex-direction: column;
    gap: 4px;
  }
  
  .toggle-btn {
    padding: 10px 16px;
  }

  .generate-btn.compact {
    font-size: 14px;
    padding: 12px 16px;
  }

  .upload-area {
    min-height: 100px;
    padding: 12px 8px;
  }

  .upload-placeholder svg {
    width: 28px !important;
    height: 28px !important;
    margin: 0 auto 6px !important;
  }

  .upload-placeholder p {
    font-size: 13px;
  }

  .upload-placeholder span {
    font-size: 11px;
  }

  .uploads-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .generate-btn {
    width: 100%;
    max-width: none;
    margin: 16px 0;
    font-size: 14px;
    padding: 12px 16px;
  }
}

/* Gallery Layout for Templates - Pinterest Style Masonry */
.gallery-grid-template-images {
  column-count: 3;
  column-gap: 24px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  /* Masonry layout properties */
  column-fill: balance;
  orphans: 1;
  widows: 1;
}

.gallery-column {
  break-inside: avoid;
  margin-bottom: 24px;
  display: block;
  width: 100%;
}

.gallery-template-item {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  width: 100%;
  height: auto;
  margin-bottom: 16px;
  /* Remove fixed aspect ratio for masonry flexibility */
}

.gallery-template-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.gallery-template-item.tall {
  /* Let natural image height determine size */
  height: auto;
}

.gallery-template-item.short {
  /* Let natural image height determine size */
  height: auto;
}

.gallery-template-item img {
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
  /* Better for masonry layout */
  display: block;
  /* Ensure images don't break masonry flow */
  max-width: 100%;
}

/* Better image positioning for different template types */
.gallery-template-item.tall img {
  object-fit: cover;
  object-position: center top; /* Focus on top for tall images */
}

.gallery-template-item.short img {
  object-fit: cover;
  object-position: center; /* Center for short images */
}

/* Alternative: Use contain for better image preservation */
.gallery-template-item img.alternative-fit {
  object-fit: contain;
  background: #f8f9fa;
}

/* Smart image cropping based on aspect ratio */
.gallery-template-item img.smart-crop {
  object-fit: cover;
  object-position: center;
}

/* Portrait images - focus on center */
.gallery-template-item img.portrait {
  object-fit: cover;
  object-position: center;
}

/* Landscape images - focus on center */
.gallery-template-item img.landscape {
  object-fit: cover;
  object-position: center;
}

/* Square images - perfect fit */
.gallery-template-item img.square {
  object-fit: cover;
  object-position: center;
}

/* Custom positioning for specific template types */
.gallery-template-item[data-template-type="portrait"] img {
  object-position: center top;
}

.gallery-template-item[data-template-type="landscape"] img {
  object-position: center;
}

.gallery-template-item[data-template-type="square"] img {
  object-position: center;
}

/* Preserve full image without cropping */
.gallery-template-item img.preserve-image {
  object-fit: contain;
  background: #f8f9fa;
  padding: 8px;
}

/* Smart cropping that focuses on the most important part */
.gallery-template-item img.smart-focus {
  object-fit: cover;
  object-position: center;
}

/* For images that need to show the full width */
.gallery-template-item img.show-full-width {
  object-fit: cover;
  object-position: center;
  width: auto;
  max-width: 100%;
  height: 100%;
}

/* For images that need to show the full height */
.gallery-template-item img.show-full-height {
  object-fit: cover;
  object-position: center;
  width: 100%;
  height: auto;
  max-height: 100%;
}

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

.gallery-template-item .template-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  transition: background 0.4s ease;
}

.gallery-template-item:hover .template-icon {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.gallery-template-item .template-icon svg {
  width: 60px !important;
  height: 60px !important;
  color: #6b7280;
  transition: color 0.4s ease;
}

.gallery-template-item:hover .template-icon svg {
  color: #495057;
}

/* Video preview styles */
.video-preview-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-preview-container:hover .video-preview {
  transform: scale(1.05);
}

.video-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.video-preview-container:hover .video-play-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.video-play-icon {
  width: 80px !important;
  height: 80px !important;
  color: white;
  opacity: 0.9;
  transition: all 0.3s ease;
  margin: 0 !important;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.video-preview-container:hover .video-play-icon {
  opacity: 1;
  transform: scale(1.1);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7));
}

.video-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}



/* Chat button positioning */

.chat-link-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.chat-link-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  text-decoration: none;
}

.chat-icon {
  width: 16px !important;
  height: 16px !important;
  color: #374151;
  margin: 0 !important;
}

/* Modern Pagination Styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 40px 0 20px 0;
  padding: 0;
  list-style: none;
}

.pagination li {
  margin: 0;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0;
  background: white;
  color: #64748b;
}

.pagination a:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination .current {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-color: #3b82f6;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.pagination .current:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.pagination .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8fafc;
  color: #94a3b8;
}

.pagination .disabled:hover {
  transform: none;
  box-shadow: none;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.pagination .gap {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: default;
}

.pagination .gap:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
}

/* First/Last page styles */
.pagination .first a,
.pagination .last a,
.pagination .prev a,
.pagination .next a {
  font-weight: 600;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.pagination .first a:hover,
.pagination .last a:hover,
.pagination .prev a:hover,
.pagination .next a:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

/* Responsive pagination */
@media (max-width: 768px) {
  .pagination {
    gap: 4px;
    margin: 30px 0 15px 0;
  }
  
  .pagination a,
  .pagination span {
    min-width: 36px;
    height: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }
  
  /* Hide some elements on mobile */
  .pagination .first,
  .pagination .last {
    display: none;
  }
}

@media (max-width: 480px) {
  .pagination {
    gap: 2px;
  }
  
  .pagination a,
  .pagination span {
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* Modal styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  margin: auto;
  display: block;
}

.modal-content img,
.modal-content video {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.close:hover,
.close:focus {
  color: #ccc;
  text-decoration: none;
}

/* Template card link improvements */
.template-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.template-card-link:hover {
  text-decoration: none;
  color: inherit;
}

/* Loading state for templates */
.gallery-template-item.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Empty state improvements */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  color: #d1d5db;
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #374151;
}

.empty-description {
  font-size: 1rem;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto;
}

.item-template-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: all 0.4s ease;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.gallery-template-item:hover .item-template-overlay {
  opacity: 1;
}

.item-type {
  background: rgba(255, 255, 255, 0.95);
  color: #18181b;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.item-type:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.05);
}

/* Responsive for gallery - Masonry Layout */
@media (max-width: 1024px) {
  .gallery-grid-template-images {
    column-count: 3;
    column-gap: 20px;
    padding: 0 16px;
  }
}

@media (max-width: 768px) {
  .gallery-grid-template-images {
    column-count: 2;
    column-gap: 16px;
    padding: 0 16px;
  }
  
  .gallery-template-item {
    border-radius: 16px;
  }
  
  .gallery-template-item .template-icon svg {
    width: 50px !important;
    height: 50px !important;
  }
}

@media (max-width: 480px) {
  .gallery-grid-template-images {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 12px;
  }
  
  .item-type {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  /* Better image handling on small screens */
  .gallery-template-item img {
    object-position: center;
  }
  
  .gallery-template-item img.preserve-image {
    padding: 4px;
  }
}

/* Login Modal Styles */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.login-modal-content {
  background: white;
  border-radius: 16px;
  padding: 0;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-modal-header {
  padding: 24px 24px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 24px;
}

.login-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
}

.login-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.login-modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.login-modal-body {
  padding: 0 24px 24px 24px;
}

.login-modal-body p {
  margin: 0 0 24px 0;
  color: #6b7280;
  font-size: 16px;
  line-height: 1.5;
}

.google-login-btn {
  width: 100%;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.google-login-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.google-login-btn:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-modal-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}

.login-modal-footer p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

.login-modal-footer a {
  color: #3b82f6;
  text-decoration: none;
}

.login-modal-footer a:hover {
  text-decoration: underline;
}

/* Toast Notification Styles */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
}

.toast-notification {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-bottom: 12px;
  padding: 16px;
  min-width: 300px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: auto;
}

.toast-notification.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-message {
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

/* Toast type variants */
.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-warning {
  border-left: 4px solid #f59e0b;
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

/* Responsive toast */
@media (max-width: 480px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .toast-notification {
    min-width: auto;
    width: 100%;
  }
}
