/* Popup Styles */
.tty-clc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    overflow: auto;
    backdrop-filter: blur(4px);
    opacity: 0;
    animation: fadeIn 0.25s ease forwards;
    display: none;
}

.tty-clc-popup.open ~ .tty-clc-overlay,
.tty-clc-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tty-clc-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: var(--tty-bg-primary);
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease, height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 830px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.tty-clc-popup.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Header */
.tty-clc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--tty-border-light);
    background-color: var(--tty-bg-primary);
}

.tty-clc-tabs {
    display: flex;
    gap: 15px;
    margin: 15px 0px -25px 0px;
}

.tty-clc-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 17px;
    color: var(--tty-text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.tty-clc-tab:hover {
    color: var(--tty-primary);
}

.tty-clc-tab.active {
    color: var(--tty-primary);
    border-bottom-color: var(--tty-secondary);
}

.tty-clc-close {
    width: 40px;
  height: 40px;
  border: none;
  background: var(--tty-bg-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--tty-text-secondary);
}

.tty-clc-close:hover {
  background: #ff4444;
  color: white;
  transform: rotate(90deg);
}

/* Content */
.tty-clc-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
    background-color: var(--tty-bg-primary);
    position: relative;
}

.tty-clc-tab-content {
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.tty-clc-tab-content.active {
    display: block;
    opacity: 1;
    animation: tabFadeIn 0.3s ease-in-out;
}

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

/* Grid met min-height voor consistentie */
.tty-clc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    min-height: 200px;
    transition: all 0.3s ease;
}


/* Language Items */
.tty-clc-language-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px solid var(--tty-border-light);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background-color: var(--tty-bg-primary);
}

.tty-clc-flag-container {
    width: 40px;
    height: 40px;
}

.tty-clc-language-item:hover {
    border-color: var(--tty-primary);
    background-color: var(--tty-bg-tertiary);
}

.tty-clc-language-item:hover .tty-clc-flag {
  border: 2px solid #29ae5d;
  background: #29ae5d;
  animation: pulse-border 2s infinite;
}

.tty-clc-language-item.active {
    border-color: var(--tty-primary);
    background-color: var(--tty-primary-bg);
}

.tty-clc-flag {
    width: 40px !important;
    height: 40px !important;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--tty-bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    cursor: cell;
}

.tty-clc-language-item.active .tty-clc-flag {
    border: 2px solid #29ae5d;
    background: #29ae5d;
    animation: pulse-border 2s infinite;
}

.tty-clc-language-info {
    flex: 1;
}

.tty-clc-language-name {
    display: block;
    font-size: 13px;
    color: var(--tty-text-secondary);
    display: none;
}

/* Currency Items */
.tty-clc-currency-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px solid var(--tty-border-light);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background-color: var(--tty-bg-primary);
    height: 74px;
}

.tty-clc-currency-item:hover {
    border-color: var(--tty-primary);
    background-color: var(--tty-bg-tertiary);
}

.tty-clc-currency-item.active {
    border-color: var(--tty-primary);
    background-color: var(--tty-primary-bg);
    overflow: visible;
    z-index: 9;
}

.tty-clc-currency-symbol {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--tty-primary);
    background-color: var(--tty-bg-secondary);
    border-radius: 50%;
    border: 2px solid var(--tty-bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.tty-clc-currency-item:hover .tty-clc-currency-symbol,
.tty-clc-currency-item.active .tty-clc-currency-symbol {
  border: 2px solid #29ae5d;
  animation: pulse-border 2s infinite;
}

.tty-clc-currency-info {
    flex: 1;
}

.tty-clc-currency-code {
    display: block;
    font-weight: 600;
    color: var(--tty-text-primary);
}

.tty-clc-currency-name {
    display: block;
    font-size: 14px;
    color: var(--tty-text-secondary);
}

/* Check mark */
.tty-clc-check {
  position: absolute;
  color: white;
  top: 8px;
  left: 42px;
  font-size: 12px;
  width: 25px !important;
  height: 25px !important;
  border-radius: 50%;
  border: 2px solid var(--tty-bg-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  background: #269268;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Loading */
.tty-clc-loading {
    text-align: center;
    padding: 40px;
    color: var(--tty-text-secondary);
}

.tty-clc-loading i {
    font-size: 24px;
    margin-bottom: 10px;
}

.tty-clc-currency-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Message styles */
.tty-clc-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.tty-clc-message.tty-clc-success {
    background-color: rgba(0, 95, 95, 0.1);
    color: var(--tty-success);
    border: 1px solid rgba(0, 95, 95, 0.2);
}

.tty-clc-message.tty-clc-error {
    background-color: rgba(191, 97, 82, 0.1);
    color: var(--tty-error);
    border: 1px solid rgba(191, 97, 82, 0.2);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .tty-clc-popup {
        width: 95%;
        max-height: 90vh;
    }
    
    .tty-clc-grid {
        grid-template-columns: 1fr;
    }
    
    .tty-clc-tabs {
        gap: 10px;
    }
    
    .tty-clc-tab {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .tty-clc-tab span {
        display: none;
    }
}

/* Flag styles in popup */
.tty-clc-item-flag {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Hover effect on flags */
.tty-clc-item:hover .tty-clc-item-flag {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Prevent body scroll when popup is open */
body.tty-clc-popup-open {
    overflow: hidden;
}

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


/* Currency selector loading state */
.currency-selector .currency-current[data-loading="true"]:before {
    content: "€ EUR"; /* Default placeholder */
    opacity: 0.3;
}

/* Ensure no layout shift */
.currency-selector {
    min-width: 90px;
    display: inline-flex;
    align-items: center;
}

.currency-selector .currency-current {
    min-width: 60px;
    white-space: nowrap;
}