:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-color: #667eea;
  --accent-hover: #5568d3;
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.3);
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --toggle-active: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --toggle-inactive: #e2e8f0;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.cookie-popup-container,
.cookie-popup-container * {
  box-sizing: border-box;
}

.cookie-popup-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 999999;
  padding: 20px;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-popup {
  max-width: 580px;
  width: 100%;
  background: var(--glass-bg);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.4s ease-out;
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

/* Header Section */
.cookie-popup-header {
  padding: 32px 32px 24px;
  text-align: center;
  background: linear-gradient(180deg, #f7fafc 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
  border-radius: 30px;
  flex-shrink: 0;
}

.cookie-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--primary-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
  animation: bounce 0.6s ease-out;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.cookie-popup-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.cookie-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Panel Tabs (hidden by default, shown when customizing) */
.cookie-panel {
  display: none;
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
}

.cookie-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.cookie-panel ul li {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
}

.cookie-panel ul li:hover {
  background: rgba(102, 126, 234, 0.05);
}

.cookie-panel ul li.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: white;
}

/* Content Container */
.cookie-popup-content-container {
  height: 0;
  overflow: hidden;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 0 0 auto;
}

.cookie-popup-content-container.open {
  height: auto;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 200px;
}

/* Custom Scrollbar */
.cookie-popup-content-container::-webkit-scrollbar {
  width: 6px;
}

.cookie-popup-content-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.cookie-popup-content-container::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

.cookie-popup-content-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Cookie Categories */
.cookie-cookies-display {
  padding: 24px;
  padding-bottom: 16px;
}

.cookies-header {
  margin-bottom: 20px;
  text-align: center;
}

.cookies-header h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.cookies-header p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.cookie-category {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.cookie-category:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.cat-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.cat-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  flex-shrink: 0;
}

.cookie-cat-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.choose {
  width: 48px;
  height: 26px;
  background: var(--toggle-inactive);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.choose::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.choose.active {
  background: var(--toggle-active);
}

.choose.active::after {
  transform: translateX(22px);
}

.choose.always-on {
  background: #cbd5e0;
  cursor: not-allowed;
  opacity: 0.7;
}

.choose.always-on::after {
  transform: translateX(22px);
  background: #a0aec0;
}

.cat-describe {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-left: 52px;
}

/* Bottom Section */
.cookie-decide {
  background: white;
  border-top: 1px solid #e2e8f0;
  padding: 20px 24px;
  border-radius: 20px;
  flex-shrink: 0;
}

.pre-cookie-box {
  margin-bottom: 16px;
}

.cookie-info-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.cookie-info-text svg {
  flex-shrink: 0;
  color: var(--accent-color);
}

/* Action Buttons */
.cookie-actions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cookie-actions li {
  flex: 1;
  min-width: 140px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid transparent;
}

.cookie-actions li svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.cookie-actions li.customize {
  background: white;
  color: var(--accent-color);
  border-color: #e2e8f0;
}

.cookie-actions li.customize:hover {
  border-color: var(--accent-color);
  background: #f7fafc;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.cookie-actions li.allow-selection {
  display: none;
  background: white;
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.cookie-actions li.allow-selection:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cookie-actions li.allow {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.cookie-actions li.allow:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.cookie-actions li.allow svg {
  stroke: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  .cookie-popup {
    border-radius: 20px;
    margin: 10px;
  }

  .cookie-popup-header {
    padding: 24px 20px 20px;
  }

  .cookie-popup-header h2 {
    font-size: 20px;
  }

  .cookie-subtitle {
    font-size: 13px;
  }

  .cookie-icon {
    width: 48px;
    height: 48px;
  }

  .cookie-icon svg {
    width: 28px;
    height: 28px;
  }

  .cookie-cookies-display {
    padding: 16px;
  }

  .cookie-category {
    padding: 16px;
  }

  .cat-icon {
    width: 36px;
    height: 36px;
  }

  .cookie-cat-name {
    font-size: 15px;
  }

  .cat-describe {
    padding-left: 48px;
    font-size: 12px;
  }

  .cookie-decide {
    padding: 16px;
  }

  .cookie-actions {
    flex-direction: column;
  }

  .cookie-actions li {
    min-width: 100%;
    width: 100%;
  }

  .cookie-popup-content-container.open {
    min-height: 150px;
  }
}

@media (max-width: 480px) {
  .cookie-popup-container {
    padding: 10px;
  }

  .cookie-popup {
    border-radius: 16px;
    max-height: 95vh;
  }

  .cookie-popup-header {
    padding: 16px 16px 12px;
  }

  .cookie-popup-header h2 {
    font-size: 18px;
    margin: 0 0 6px;
  }

  .cookie-subtitle {
    font-size: 12px;
    line-height: 1.5;
  }

  .cookie-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
  }

  .cookie-cookies-display {
    padding: 12px;
  }

  .cookie-category {
    padding: 12px;
    margin-bottom: 12px;
  }

  .cat-main {
    flex-wrap: wrap;
  }

  .cat-header {
    flex: 1 1 100%;
    margin-bottom: 8px;
  }

  .toggle-wrapper {
    flex: 1 1 100%;
    justify-content: flex-end;
  }

  .cat-describe {
    padding-left: 0;
    margin-top: 8px;
    font-size: 12px;
  }

  .cookie-decide {
    padding: 12px 16px;
  }

  .cookie-actions li {
    padding: 4px 16px;
    font-size: 13px;
  }

  .cookie-popup-content-container.open {
    min-height: 120px;
  }
}

/* Height-based responsive for landscape/short screens */
@media (max-height: 700px) {
  .cookie-popup {
    max-height: 95vh;
  }

  .cookie-popup-header {
    padding: 20px 24px 16px;
  }

  .cookie-popup-header h2 {
    font-size: 20px;
    margin: 0 0 6px;
  }

  .cookie-subtitle {
    font-size: 13px;
  }

  .cookie-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
  }

  .cookie-cookies-display {
    padding: 16px;
  }

  .cookie-category {
    padding: 14px;
    margin-bottom: 12px;
  }

  .cookie-decide {
    padding: 16px 20px;
  }

  .cookie-popup-content-container.open {
    min-height: 100px;
  }
}

@media (max-height: 600px) {
  .cookie-popup {
    max-height: 98vh;
  }

  .cookie-popup-header {
    padding: 16px 20px 12px;
  }

  .cookie-popup-header h2 {
    font-size: 18px;
    margin: 0 0 4px;
  }

  .cookie-subtitle {
    font-size: 12px;
    line-height: 1.4;
  }

  .cookie-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
  }

  .cookie-cookies-display {
    padding: 12px;
  }

  .cookies-header h3 {
    font-size: 16px;
    margin: 0 0 8px;
  }

  .cookies-header p {
    font-size: 13px;
  }

  .cookie-category {
    padding: 12px;
    margin-bottom: 10px;
  }

  .cat-describe {
    font-size: 13px;
  }

  .cookie-decide {
    padding: 12px 16px;
  }

  .cookie-actions li {
    padding: 10px 16px;
    font-size: 13px;
  }

  .cookie-popup-content-container.open {
    min-height: 80px;
  }
}

/* Utility Classes */
.cookie-hidden {
  display: none !important;
}

/* Animations for cookie categories */
.cookie-category {
  animation: slideInCategory 0.3s ease-out backwards;
}

.cookie-category:nth-child(1) {
  animation-delay: 0.1s;
}

.cookie-category:nth-child(2) {
  animation-delay: 0.15s;
}

.cookie-category:nth-child(3) {
  animation-delay: 0.2s;
}

.cookie-category:nth-child(4) {
  animation-delay: 0.25s;
}

.cookie-category:nth-child(5) {
  animation-delay: 0.3s;
}

@keyframes slideInCategory {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
