.palette-generator-wrapper .tool-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-top: 4px solid var(--primary) !important;
}

.palette-generator-wrapper h1 {
    font-size: 2.25rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Toolbar */
.palette-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.toolbar-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Export Dropdown */
.dropdown-wrapper {
    position: relative;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid var(--gray-200);
    min-width: 200px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    animation: slideDown 0.2s ease forwards;
}

.export-menu.hidden {
    display: none;
}

.export-option {
    padding: 0.75rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.export-option:hover {
    background: var(--gray-100);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Main Palette Container */
.palette-container {
    display: flex;
    height: 500px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

.color-swatch {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: flex 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
    padding: 1.5rem 1rem;
    position: relative;
    group: swatch;
}

/* On Desktop hover, expand the column slightly */
@media (min-width: 768px) {
    .color-swatch:hover {
        flex: 1.2;
    }
}

/* Swatch Controls (Lock, Copy) */
.swatch-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.color-swatch:hover .swatch-controls {
    opacity: 1;
    transform: translateY(0);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.btn-icon.locked {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(0, 0, 0, 0.5);
    color: white !important; /* Force white icon when locked for contrast */
}
.btn-icon.locked i::before {
    content: "\f023"; /* fa-lock */
}

/* Swatch Info */
.swatch-info {
    text-align: center;
    transition: transform 0.3s ease;
}

.color-swatch:hover .swatch-info {
    transform: translateY(-10px);
}

.hex-input {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Inter', monospace;
    text-align: center;
    text-transform: uppercase;
    width: 100%;
    outline: none;
    letter-spacing: 1px;
    cursor: text;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.hex-input:focus {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

/* History */
.history-palettes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.history-item {
    display: flex;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-200);
    transition: transform 0.2s;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.history-color {
    flex: 1;
    height: 100%;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    font-size: 0.95rem;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }

.btn-action { background: var(--white); border: 1px solid var(--gray-300); color: var(--text); }
.btn-action:hover { background: var(--gray-100); border-color: var(--primary); color: var(--primary); }

.btn-danger { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; border-color: #ef4444; }

.btn-outline { background: transparent; border: 2px solid var(--gray-200); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(0, 102, 204, 0.05); }

/* Select */
.custom-select {
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    background-color: var(--white);
    font-family: 'Inter', sans-serif;
    color: var(--text);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
}

/* Toast */
#copyMessageBox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    font-weight: 600;
}
#copyMessageBox.show {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .palette-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    .palette-container {
        flex-direction: column;
        height: 600px; /* Taller for mobile stacking */
    }
    .swatch-controls {
        opacity: 1; /* Always show controls on mobile */
        transform: translateY(0);
        flex-direction: row;
    }
    .color-swatch {
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 1rem;
    }
    .color-swatch:hover .swatch-info {
        transform: none; /* Disable hover lift on mobile */
    }
    .hex-input {
        font-size: 1.2rem;
        text-align: right;
    }
    .color-name {
        display: none; /* hide color name to save space on mobile */
    }
}