/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@300;400;500;600;700&display=swap');

/* Base Styles */
:root {
    --dark-bg: #1a1a1a;
    --dark-surface: #252525;
    --vibrant-blue: #007FFF;
    --light-blue: #3399FF;
    --dark-blue: #0059B2;
    --text-primary: #ffffff;
    --text-secondary: #B2BAC2;
    --param-url: #00C853;
    --param-medium: #FF6D00;
    --param-source: #D500F9;
    --param-campaign: #00B8D4;
    --param-term: #FFAB00;
}
.history-header {
    color: var(--text-primary);
}

.reset-icon, .copy-icon {
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.copy-all-icon {
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.2s ease;
    stroke: #ff9800;  /* Change to orange */
}

.copy-all-icon:hover {
    transform: scale(1.1);
    stroke: var(--vibrant-blue);
}

.reset-icon {
    stroke: #ff4444;  /* Change to red */
}

.reset-icon:hover {
    transform: rotate(90deg);
}

.copy-icon {
    stroke: var(--text-primary);
}

.copy-icon:hover {
    stroke: var(--vibrant-blue);
    transform: scale(1.1);
}

body {
    font-family: 'Hind', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    padding-bottom: 8rem;
}

/* Form Styles */
.unified-input {
    border: 1px solid var(--vibrant-blue);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 0.25rem;
    align-items: flex-start;
    flex-wrap: nowrap;
    transition: border-color 0.3s ease;
}

.param-group {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.param-url {
    flex: 2;
}

.param-medium,
.param-source,
.param-term {
    flex: 0 0 100px;
}

.param-campaign {
    flex: 0 0 160px;
}

.param-url {
    flex: 3;
}

.param-group input {
    width: 100%;
    min-width: 0;
}

.param-label {
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
    opacity: 0.8;
}

.param-url .param-label { color: var(--param-url); }
.param-medium .param-label { color: var(--param-medium); }
.param-source .param-label { color: var(--param-source); }
.param-campaign .param-label { color: var(--param-campaign); }
.param-term .param-label { color: var(--param-term); }

.validation-message {
    font-size: 0.75rem;
    color: #ff4444;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.15rem;
    min-height: 0;
}

.form-control {
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.25rem 0;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--dark-blue);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.param-url .form-control { border-bottom-color: var(--param-url); }
.param-medium .form-control { border-bottom-color: var(--param-medium); }
.param-source .form-control { border-bottom-color: var(--param-source); }
.param-campaign .form-control { border-bottom-color: var(--param-campaign); }
.param-term .form-control { border-bottom-color: var(--param-term); }

.form-control:focus {
    background-color: transparent;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.25);
    outline: none;
}

.form-control:not(:placeholder-shown) {
    font-weight: bold;
    font-style: italic;
}
/* Placeholder Styles */
.form-control::placeholder {
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.7);
}

/* Webkit browsers */
.form-control::-webkit-input-placeholder {
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.7);
}

/* Firefox */
.form-control::-moz-placeholder {
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.7);
}

/* Microsoft Edge */
.form-control::-ms-input-placeholder {
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.7);
}

/* Button Styles */
.btn-primary {
    background-color: var(--vibrant-blue);
    border-color: var(--vibrant-blue);
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--light-blue);
    border-color: var(--light-blue);
    transform: translateY(-1px);
}

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

/* Table Styles */
.history-section {
    margin-top: 2rem;
    position: relative;
}

.table-responsive {
    background-color: var(--dark-bg);
    border-radius: 8px;
    padding: 1px;
    border: 1px solid var(--vibrant-blue);
    margin-bottom: 0;
}

.table {
    table-layout: fixed;
    width: 100%;
    background-color: var(--dark-surface);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
}

/* Set specific widths for each column */
.table th:nth-child(1), .table td:nth-child(1) { width: 30%; } /* url */
.table th:nth-child(2), .table td:nth-child(2) { width: 12%; } /* medium */
.table th:nth-child(3), .table td:nth-child(3) { width: 12%; } /* source */
.table th:nth-child(4), .table td:nth-child(4) { width: 30%; } /* campaign */
.table th:nth-child(5), .table td:nth-child(5) { width: 8%; }  /* term */
.table th:nth-child(6), .table td:nth-child(6) { width: 80px; min-width: 80px; }  /* actions */

/* Cell content truncation */
.table td {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    height: 40px;
    padding: 0.25rem 0.5rem;
    position: relative;
    background-color: var(--dark-surface);
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 127, 255, 0.1);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--dark-bg);
}

.table thead th {
    position: sticky;
    top: 0;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    border-bottom: 1px solid var(--vibrant-blue);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 0.5rem;
    height: 40px;
}

.table tbody {
    background-color: var(--dark-surface);
}

.table tbody tr:hover td {
    background-color: rgba(33, 150, 243, 0.08);
}

/* Tooltip on hover */
.table td:not(.action-icons) {
    cursor: default;
}

.table tbody tr td:nth-child(4) {
    position: relative;
}

.table tbody tr td:nth-child(4):hover:before {
    content: attr(data-full-text);
    position: fixed;
    background: var(--dark-surface);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--vibrant-blue);
    z-index: 99999;
    white-space: normal;
    word-break: break-all;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
    left: var(--tooltip-x);
    top: var(--tooltip-y);
}

/* Action icons column */
.table td.action-icons {
    overflow: visible;
    padding: 0.25rem;
    text-align: center;
    width: 80px;
    min-width: 80px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--dark-surface);
}

.action-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    visibility: visible !important;
    position: relative;
    z-index: 10;
    width: 80px;
    justify-content: center;
}

.qr-icon, .copy-icon {
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.qr-icon {
    stroke: #4a9eff;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.2s ease;
}

.qr-icon:hover {
    stroke: #2196f3;
    transform: scale(1.1);
}

.qr-icon.loading {
    animation: pulse 1.5s infinite;
}

.qr-icon.loading .spinner {
    animation: spin 1s linear infinite;
    transform-origin: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Cheat Sheet Styles */
.cheat-sheet-container {
    margin-top: 2rem;
    margin-bottom: 6rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    background: var(--dark-bg);
    border: 1px solid var(--vibrant-blue);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.cheat-sheet-header {
    padding: 1rem;
    background: var(--vibrant-blue);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.3s ease;
}

.terminal-prompt {
    color: #50fa7b;
    font-weight: bold;
}

.chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.cheat-sheet-header.collapsed .chevron {
    transform: rotate(-90deg);
}

.cheat-sheet-content {
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease-in-out;
    background: #1a1a1a;
    padding: 1rem;
    margin-bottom: 0;
}

.cheat-sheet-content.collapsed {
    max-height: 0;
    padding: 0 1rem;
    overflow: hidden;
}

.terminal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    font-size: 0.7rem;
    line-height: 1.2;
}

.medium-group {
    background: #252525;
    border-radius: 4px;
    padding: 0.5rem;
    border-left: 2px solid var(--vibrant-blue);
}

.medium-name {
    color: #ff79c6;
    margin-bottom: 0.2rem;
    font-size: 0.7rem;
    font-weight: bold;
}

.source-list {
    color: #8be9fd;
    padding-left: 0.5rem;
}

.source-item {
    display: inline-block;
    margin-right: 0.25rem;
    margin-bottom: 0.2rem;
    padding: 0.1rem 0.25rem;
    background: #333;
    border-radius: 2px;
    color: #50fa7b;
    font-size: 0.65rem;
}

/* Add a custom scrollbar for the terminal */
.cheat-sheet-content::-webkit-scrollbar {
    width: 8px;
}

.cheat-sheet-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.cheat-sheet-content::-webkit-scrollbar-thumb {
    background: var(--vibrant-blue);
    border-radius: 4px;
}

.cheat-sheet-content::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

@media (max-width: 768px) {
    .terminal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* Cheat Sheet Tab Styles */
.cheat-sheet-tabs {
    display: flex;
    justify-content: center;
    padding: 1rem 0.5rem;
    margin-bottom: 1rem;
}

.toggle-container {
    display: inline-flex;
    background: #252525;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #333;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    position: relative;
    min-width: 140px;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    color: #fff;
    background: var(--vibrant-blue);
    border-radius: 4px;
}

.tab-content {
    padding: 0 0.75rem;
}

.tab-pane {
    display: none;
}

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

.coming-soon {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
    font-style: italic;
    font-size: 0.9rem;
}

/* Credit Section */
.credit-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 0;
    text-align: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--dark-bg);
    z-index: 100;
}

.credit-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
}

.heart-trigger {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
    transform-origin: center;
}

.heart-trigger:hover {
    transform: scale(1.2);
}

@keyframes emoji-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.heart-trigger.changing {
    animation: emoji-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.credit-image {
    position: absolute;
    bottom: 100%;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.credit-image img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    object-fit: cover;
    transition: transform 0.2s ease;
}

.credit-image img:hover {
    transform: scale(0.95);
}

.heart-trigger:hover + .credit-image:not(.hidden),
.credit-image:hover:not(.hidden),
.credit-image.visible:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* Remove special-entry styles that are no longer needed */
.special-entry {
    display: none;
}

/* Campaign Builder Styles */
.campaign-builder {
    position: relative;
    margin-top: 0.15rem;
    width: 100%;
}

.campaign-parts {
    display: flex;
    gap: 0;
    font-size: 0.75rem;
    width: 100%;
}

.campaign-part {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.15rem 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    position: relative;
}

.campaign-part:not(:last-child)::after {
    content: '-';
    position: absolute;
    right: -1px;
    color: var(--text-secondary);
}

.campaign-part:hover {
    background-color: transparent;
    color: var(--param-campaign);
}

.campaign-dropdown {
    display: none;
    position: fixed;
    background-color: var(--dark-surface);
    border: 1px solid var(--param-campaign);
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.campaign-dropdown .campaign-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.campaign-dropdown .campaign-item:last-child {
    border-bottom: none;
}

.campaign-dropdown .campaign-item:hover {
    background-color: var(--param-campaign);
}

/* Campaign Cheatsheet Styles */
.campaign-format {
    background: #252525;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 2px solid var(--vibrant-blue);
}

.campaign-format h3 {
    color: #ff79c6;
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
}

.campaign-format code {
    display: block;
    padding: 0.5rem;
    background-color: #1a1a1a;
    border-radius: 4px;
    margin-top: 0.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    color: #50fa7b;
    font-size: 0.7rem;
}

.campaign-sections {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0.75rem;
    font-size: 0.7rem;
    line-height: 1.2;
}

.campaign-section {
    background: #252525;
    padding: 0.75rem;
    border-radius: 4px;
    border-left: 2px solid var(--vibrant-blue);
}

.campaign-section.stacked {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.campaign-section.stacked > div {
    background: #252525;
    padding: 0.75rem;
    border-radius: 4px;
    border-left: 2px solid var(--vibrant-blue);
}

.campaign-section.products {
    grid-column: 2;
}

.campaign-section h4 {
    color: #ff79c6;
    margin-bottom: 0.2rem;
    font-size: 0.7rem;
    font-weight: bold;
}

.campaign-items {
    display: grid;
    gap: 0.25rem;
    padding-left: 0.25rem;
}

.campaign-items.two-columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem 0.75rem;
}

.campaign-items .campaign-item {
    padding: 0.1rem 0.25rem;
    background: #333;
    border-radius: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
}

.campaign-items .item-display {
    color: #8be9fd;
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.campaign-items .item-value {
    color: #50fa7b;
    font-size: 0.65rem;
    opacity: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Update the tab content padding to match Medium & Source */
.tab-content {
    padding: 0 0.75rem;
}

/* Make both tabs consistent in their layout */
.terminal-grid,
.campaign-sections {
    margin-bottom: 1rem;
}

/* Scrollbar Styles for Campaign Dropdown */
.campaign-dropdown::-webkit-scrollbar {
    width: 8px;
}

.campaign-dropdown::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

.campaign-dropdown::-webkit-scrollbar-thumb {
    background: var(--param-campaign);
    border-radius: 4px;
}

.campaign-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--param-campaign);
    opacity: 0.8;
}

/* Campaign column tooltip */
.table-responsive .table tbody tr td:nth-child(4) {
    position: relative;
}

.table-responsive .table tbody tr td:nth-child(4):hover::after {
    content: attr(data-full-text);
    position: absolute;
    left: 0;
    top: 100%;
    background: var(--dark-surface);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--vibrant-blue);
    z-index: 1000;
    white-space: normal;
    word-break: break-all;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
    pointer-events: none;
}

/* Remove any other tooltip styles and use this single one */
#history-table tbody tr td:first-child,
#history-table tbody tr td:nth-child(4) {
    cursor: pointer;
    position: relative;
}

#history-table tbody tr td:first-child:hover::before,
#history-table tbody tr td:nth-child(4):hover::before {
    content: attr(data-full-text);
    position: fixed;
    background: var(--dark-surface);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--vibrant-blue);
    z-index: 99999;
    white-space: normal;
    word-break: break-all;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
    left: var(--tooltip-x);
    top: var(--tooltip-y);
}

#history-table tbody tr td:first-child:active,
#history-table tbody tr td:nth-child(4):active {
    opacity: 0.7;
}

/* Remove old tooltip styles */
.table-responsive .table tbody tr td:nth-child(4):hover::after,
#history-table tbody tr td:first-child[data-full-text]:hover::after {
    display: none;
}

.generate-btn {
    margin-top: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.75rem;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.95);
}

.button-emoji {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.generate-btn svg {
    transition: transform 0.2s ease;
    stroke: #50fa7b;
}

.generate-btn:hover svg {
    transform: rotate(45deg);
}

/* URL Quick Select Styles */
.url-quick-select {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.url-btn {
    background: transparent;
    border: none;
    padding: 0.15rem 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.url-btn[data-url*="a3dmfg"] {
    color: #94d1b8;
}

.url-btn[data-url*="hawkridgesys"] {
    color: #2d88c9;
}

.url-btn[data-url*="solidprofessor"] {
    color: #64a33d;
}

.url-btn:hover {
    opacity: 0.8;
    transform: translateX(2px);
}

.url-btn:active {
    transform: translateX(4px);
}

.url-btn:not(:last-child)::after {
    content: '-';
    position: absolute;
    right: -0.5rem;
    color: var(--text-secondary);
}

.table thead tr,
.table tbody tr {
    width: 100%;
    table-layout: fixed;
}

/* Tree toggle for campaign validation */
.tree-toggle {
    margin-left: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.tree-toggle:hover {
    transform: scale(1.2);
    opacity: 0.9;
}

.tree-toggle:hover::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    top: -30px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
}

.tree-toggle:hover::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -8px;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent;
    z-index: 100;
}
