/* Gradient Generator Styles */

/* Gradient Preview */
.gradient-preview {
    width: 100%;
    height: 250px;
    border: 2px solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Color Stops Container */
#colorStopsContainer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Gradient Bar with Draggable Stops */
.gradient-bar-container {
    position: relative;
    width: 100%;
    height: 80px;
    margin: 20px 0;
}

.gradient-bar {
    position: relative;
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--bs-border-color);
    cursor: pointer;
}

.color-stop-marker {
    position: absolute;
    top: -10px;
    transform: translateX(-50%);
    cursor: grab;
    user-select: none;
    z-index: 10;
}

.color-stop-marker:active {
    cursor: grabbing;
}

.color-stop-marker.selected {
    z-index: 20;
}

.stop-handle {
    width: 20px;
    height: 60px;
    background: #fff;
    border: 3px solid var(--bs-border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: relative;
    transition: all 0.2s ease;
}

.stop-handle::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--bs-border-color);
}

.color-stop-marker:hover .stop-handle {
    border-color: #052c65;
    transform: scale(1.1);
}

.color-stop-marker.selected .stop-handle {
    border-color: #052c65;
    border-width: 4px;
}

.stop-color {
    width: 100%;
    height: 100%;
    border-radius: 2px;
}

.stop-position-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.color-stop-marker:hover .stop-position-label,
.color-stop-marker.dragging .stop-position-label {
    opacity: 1;
}

.color-stop-item {
    padding: 12px;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.color-stop-item.selected {
    border-color: #052c65;
    box-shadow: 0 2px 8px rgba(5, 44, 101, 0.2);
    background: rgba(5, 44, 101, 0.05);
}

.color-stop-item:hover {
    border-color: #052c65;
    box-shadow: 0 2px 8px rgba(5, 44, 101, 0.1);
}

.color-stop-controls {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 12px;
    align-items: end;
}

.color-stop-color .form-control-color {
    width: 80px;
    height: 40px;
    border: 2px solid var(--bs-border-color);
    border-radius: 6px;
    cursor: pointer;
}

.color-stop-color .form-control-color:hover {
    border-color: #052c65;
}

.color-stop-position input {
    text-align: center;
}

/* CSS Code Output */
.css-output {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: var(--bs-primary-text-emphasis);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

/* Preset Gradients */
.preset-gradients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.preset-item {
    height: 80px;
    border: 2px solid var(--bs-border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #052c65;
}

.preset-item:active {
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gradient-preview {
        height: 180px;
    }

    .color-stop-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .color-stop-color .form-control-color {
        width: 100%;
        max-width: 150px;
    }

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

    .preset-gradients-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .preset-item {
        height: 60px;
    }

    .css-output {
        font-size: 12px;
        padding: 12px;
    }
}

/* Dark Mode */
[data-bs-theme="dark"] .gradient-preview {
    border-color: #495057;
}

[data-bs-theme="dark"] .color-stop-item {
    background: rgba(255,255,255,0.05);
    border-color: #495057;
}

[data-bs-theme="dark"] .color-stop-item:hover {
    border-color: #6ea8fe;
}

[data-bs-theme="dark"] .color-stop-color .form-control-color {
    border-color: #495057;
}

[data-bs-theme="dark"] .color-stop-color .form-control-color:hover {
    border-color: #6ea8fe;
}

[data-bs-theme="dark"] .css-output {
    background: rgba(255,255,255,0.05);
    border-color: #495057;
}

[data-bs-theme="dark"] .preset-item {
    border-color: #495057;
}

[data-bs-theme="dark"] .preset-item:hover {
    border-color: #6ea8fe;
}

/* Custom Angle Wrapper */
#customAngleWrapper {
    margin-top: 12px;
}

#customAngleWrapper .form-label {
    font-size: 14px;
    margin-bottom: 6px;
}