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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f9fafb;
  color: #111827;
  line-height: 1.6;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: bold;
  color: #111827;
  margin-bottom: 0.5rem;
}

.header p {
  color: #6b7280;
  font-size: 1.1rem;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 2rem;
  gap: 2rem;
  flex-wrap: wrap;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.tab-button:hover {
  color: #374151;
  border-bottom-color: #d1d5db;
}

.tab-button.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* Search and Controls */
.search-controls {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  max-width: 400px;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s;
}

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

.thumbnail-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.thumbnail-bg-controls {
  display: flex;
  gap: 0.5rem;
}

.thumbnail-bg-btn {
  background: #f3f4f6;
  border: 2px solid transparent;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-bg-btn:hover {
  background: #e5e7eb;
}

.thumbnail-bg-btn.active {
  border-color: #2563eb;
  background: #dbeafe;
}

/* Brand Guidelines */
.guidelines-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  padding: 2rem;
}

.guidelines-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 100%;
  overflow: hidden;
}

.guidelines-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
}

.guidelines-icon {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guidelines-icon i {
  font-size: 2rem;
}

.guidelines-info h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.guidelines-info p {
  opacity: 0.9;
  line-height: 1.5;
}

.guidelines-content {
  padding: 2rem;
}

.guidelines-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  border-left: 4px solid #2563eb;
}

.feature i {
  color: #2563eb;
  font-size: 1.25rem;
}

.feature span {
  font-weight: 500;
  color: #374151;
}

.guidelines-actions {
  display: flex;
  justify-content: center;
}

.download-guidelines-btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
  text-decoration: none;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

.download-guidelines-btn:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(37, 99, 235, 0.35);
}

.file-type {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Loading and Error States */
.loading,
.error {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
}

.loading i {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.error {
  color: #dc2626;
}

.error i {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.hidden {
  display: none !important;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.badge {
  background: #f3f4f6;
  color: #6b7280;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.card-content {
  padding: 0 1.5rem 1.5rem;
}

/* Logo Preview */
.logo-preview {
  width: 100%;
  height: 200px;
  border: 2px dashed #d1d5db;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.logo-preview.transparent {
  background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.logo-preview.white {
  background: white;
}

.logo-preview.black {
  background: black;
}

.logo-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1rem;
}

/* Preview Controls */
.preview-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
}

.preview-btn {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Color Preview */
.color-preview {
  width: 100%;
  height: 120px;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.color-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.color-values {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.color-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.color-code {
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: "Courier New", monospace;
  font-size: 0.75rem;
}

/* Buttons */
.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.download-btn {
  background: #000;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  text-decoration: none;
}

.download-btn:hover {
  background: #374151;
  transform: translateY(-1px);
}

.custom-download-btn {
  background: black !important;
}

.custom-download-btn:hover {
  background: #047857 !important;
}

.copy-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.copy-btn.copied {
  color: #059669;
  border-color: #059669;
}

.filename {
  background: #f3f4f6;
  padding: 0.5rem;
  border-radius: 0.375rem;
  font-family: "Courier New", monospace;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Count */
.count {
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #059669;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 9999; /* Higher than all modals */
  animation: slideIn 0.3s ease;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000; /* Lower than toast */
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  background: white;
  border-radius: 0.75rem;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.lightbox-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lightbox-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.background-controls {
  display: flex;
  gap: 0.5rem;
}

.bg-btn {
  background: #f3f4f6;
  border: 2px solid transparent;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-btn:hover {
  background: #e5e7eb;
}

.bg-btn.active {
  border-color: #2563eb;
  background: #dbeafe;
}

.share-btn {
  background: #f3f4f6;
  border: none;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
}

.share-btn:hover {
  background: #e5e7eb;
  color: #2563eb;
}

.close-btn {
  background: #f3f4f6;
  border: none;
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #e5e7eb;
}

.lightbox-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  min-height: 400px;
  overflow: hidden;
}

.lightbox-preview {
  width: 100%;
  height: 100%;
  max-width: 800px;
  max-height: 600px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.lightbox-preview.transparent {
  background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.lightbox-preview.white {
  background: white;
  border: 1px solid #e5e7eb;
}

.lightbox-preview.black {
  background: black;
}

.lightbox-preview img {
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.lightbox-footer {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.lightbox-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header h1 {
    font-size: 2rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .tabs {
    gap: 1rem;
  }

  .tab-button {
    font-size: 0.875rem;
  }

  .search-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .thumbnail-controls {
    width: 100%;
    justify-content: space-between;
  }

  .guidelines-container {
    padding: 1rem;
  }

  .guidelines-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .guidelines-features {
    grid-template-columns: 1fr;
  }

  .lightbox-content {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
  }

  .lightbox-header {
    padding: 1rem;
  }

  .lightbox-image-container {
    padding: 1.5rem;
    min-height: 250px;
  }

  .lightbox-controls {
    gap: 0.5rem;
  }

  .lightbox-header h3 {
    font-size: 1.25rem;
  }

  .lightbox-preview {
    max-width: 100%;
    max-height: 350px;
  }

  .lightbox-preview img {
    max-width: calc(100% - 1rem);
    max-height: calc(100% - 1rem);
  }
}

/* Color Picker Modal - Enhanced */
.color-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000; /* Lower than toast but higher than lightbox */
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.color-picker-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.color-picker-content {
  position: relative;
  background: white;
  border-radius: 1rem;
  max-width: 600px;
  width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.3s ease-out;
}

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

.color-picker-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
}

.color-picker-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.color-picker-header .close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
}

.color-picker-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.color-picker-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 60vh;
}

.color-picker-description {
  margin-bottom: 1.5rem;
  color: #6b7280;
  text-align: center;
  font-size: 0.95rem;
}

.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.color-option {
  border: 3px solid transparent;
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 100px;
  display: flex;
  align-items: end;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.color-option:hover {
  border-color: #2563eb;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.color-option:active {
  transform: translateY(-1px);
}

.color-name {
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Special handling for light colors */
.color-option[data-color="#FFFFFF"] .color-name,
.color-option[data-color="#ffffff"] .color-name,
.color-option[data-color="#F5DEB3"] .color-name,
.color-option[data-color="#f5deb3"] .color-name {
  background: rgba(0, 0, 0, 0.85);
  color: white;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments for color picker */
@media (max-width: 768px) {
  .color-picker-content {
    width: 95vw;
    max-height: 85vh;
  }

  .color-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .color-option {
    min-height: 80px;
    padding: 0.75rem;
  }

  .color-picker-header {
    padding: 1rem;
  }

  .color-picker-header h3 {
    font-size: 1.1rem;
  }

  .color-picker-body {
    padding: 1rem;
  }
}
