/* AI Prompt Dock Component */
/* Matches Krea-like design with Social Shade "Liquid Glass" theme */

:root {
    /* Dock Specific Tokens */
    --dock-bg: rgba(10, 14, 18, 0.6);
    --dock-border: var(--glass-border);
    --dock-radius: 24px;
    --dock-padding: 16px;
    --dock-blur: 24px;

    --textarea-bg: transparent;
    --textarea-text: var(--text-primary);
    --textarea-placeholder: rgba(255, 255, 255, 0.4);

    --pill-bg: rgba(255, 255, 255, 0.05);
    --pill-bg-hover: rgba(255, 255, 255, 0.08);
    --pill-active-bg: rgba(192, 252, 0, 0.15);
    --pill-active-text: #C0FC00;
    --pill-radius: 20px;

    --btn-generate-bg: #C0FC00;
    /* Neon Green */
    --btn-generate-text: #0A0E12;
    /* Dark Surface */
    --btn-generate-disabled-bg: rgba(255, 255, 255, 0.1);
    --btn-generate-disabled-text: rgba(255, 255, 255, 0.3);
}

.promptDock {
    position: relative;
    width: 100%;
    max-width: 900px;
    /* Constrain width for better readability */
    margin: 0 auto;
    background: var(--dock-bg);
    backdrop-filter: blur(var(--dock-blur));
    -webkit-backdrop-filter: blur(var(--dock-blur));
    border: 1px solid var(--dock-border);
    border-radius: var(--dock-radius);
    padding: var(--dock-padding);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.promptDock:focus-within {
    border-color: rgba(192, 252, 0, 0.3);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(192, 252, 0, 0.1);
}

/* Left side: Input + Pills */
.promptDock__main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Textarea */
.promptDock__input {
    width: 100%;
    min-height: 56px;
    /* Starts small, expands if needed */
    max-height: 200px;
    background: var(--textarea-bg);
    color: var(--textarea-text);
    border: none;
    resize: none;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    outline: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

.promptDock__input::placeholder {
    color: var(--textarea-placeholder);
}

/* Pills Container */
.promptDock__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Pill Base */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px 0 10px;
    /* Slightly less left padding for icon balance */
    background: var(--pill-bg);
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--pill-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
}

.pill:hover {
    background: var(--pill-bg-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.pill:active {
    /* Subtle click press */
    transform: translateY(0);
}

.pill--active {
    background: var(--pill-active-bg);
    color: var(--pill-active-text);
    border-color: rgba(192, 252, 0, 0.2);
}

.pill__icon {
    font-size: 18px;
    /* Material symbols size */
    line-height: 1;
}

.pill__val {
    opacity: 0.8;
    margin-left: 4px;
}

/* Specific Pill Variants */
.pill--aspect span.ratio-box {
    width: 14px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    display: inline-block;
}

.pill--remove {
    padding: 0;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    margin-left: 4px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
}

.pill--remove:hover {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
}

/* Generate Button (Right Side) */
.promptDock__actions {
    display: flex;
    align-items: flex-end;
    /* Align to bottom to match pills */
    padding-bottom: 2px;
}

.generateBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    background: var(--btn-generate-bg);
    color: var(--btn-generate-text);
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(192, 252, 0, 0.15);
}

.generateBtn:hover:not(:disabled) {
    background: var(--green-hover);
    box-shadow: 0 6px 16px rgba(192, 252, 0, 0.25);
    transform: translateY(-1px);
}

.generateBtn:active:not(:disabled) {
    transform: translateY(0);
}

.generateBtn:disabled {
    background: var(--btn-generate-disabled-bg);
    color: var(--btn-generate-disabled-text);
    cursor: not-allowed;
    box-shadow: none;
}

/* Spinner for Loading State */
.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animation for entering state */
@keyframes dockPop {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.promptDock {
    animation: dockPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Popover Menus (Minimal) */
.dock-popover {
    position: absolute;
    bottom: 100%;
    left: 0;
    /* JS will position this */
    margin-bottom: 8px;
    background: rgba(19, 25, 34, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.95);
    transition: all 0.15s ease;
}

.dock-popover.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.popover-item {
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.popover-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.popover-item.selected {
    background: var(--pill-active-bg);
    color: var(--pill-active-text);
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .promptDock {
        grid-template-columns: 1fr;
        /* Stack vertically */
        padding: 12px;
        gap: 12px;
    }

    .generateBtn {
        width: 100%;
        height: 44px;
        margin-top: 4px;
    }

    .promptDock__actions {
        width: 100%;
        padding-bottom: 0;
    }
}