.grab-result {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;
}

.result-info {
    display: flex;
    flex-direction: column;
    opacity: 0;

    width: 100%;
    max-width: 100%;
    min-width: 200px;
    max-height: 0;

    align-items: center;
    justify-content: center;
    gap: 10px;

    font-weight: bold;
    font-size: 16px;
    color: var(--text-primary);

    transition: opacity 0.5s ease, max-height 0.5s ease;
}

.result-info.show {
    max-height: 250px;
    opacity: 1;
}

.result-info-row {
    display: flex;

    max-width: 100%;

    align-items: center;
    justify-content: center;
    gap: 12px;

    margin-top: 20px;

    background: var(--bg-result);
    transition: all 0.2s ease;
}

.result-toolbar {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    margin-top: 15px;
}

.history-search {
    display: flex;
    justify-content: flex-end;
    padding: 0 12px;
}

.history-search__wrapper {
    position: relative;
    width: auto;
}

.history-search__input {
    width: 160px;
    padding: 5px 32px 5px 28px;
    border: 2px solid var(--search-border-input);
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    background-color: var(--bg-input);
    color: var(--text-primary);
    box-shadow: inset 0 1px 2px var(--shadow);

    background-image: url('data:image/svg+xml;utf8,<svg fill="%23999" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><g><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path></g></svg>');
    background-repeat: no-repeat;
    background-position: 6px center;
    background-size: 20px 20px;
    
    transition:
        width 0.3s ease,
        border-color 0.5s ease,
        background-color 0.5s ease,
        color 0.5s ease,
        transform 0.5s ease;
}

.history-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.history-search__input:focus {
    width: 320px;
    background-color: var(--bg-input-focus);
    border-color: var(--border-input-focus);
}

.history-search__input.has-value:not(:focus) {
    border-color: var(--border-input);
}

.history-search__input:hover:not(:focus) {
    border-color: var(--border-input);
}

.input-clear__button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    
    border: none;
    color: var(--text-button-input-action);
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.history-search__wrapper.has-value .input-clear__button {
    opacity: 1;
    pointer-events: auto;
}

.result-rows__wrapper {
    display: flex;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    justify-content: center;
}

.result-rows {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    min-width: 200px;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 0 12px;
    background: var(--bg-result);
    color: var(--text-primary);
    font-size: 16px;
}

.result-rows:empty {
    border: none;
    background: transparent;
    box-shadow: none;
    min-width: 0;
    margin-top: 0;
    padding: 0;
}

.row-placeholder {
    display: none;
}

.row-no-items {
    display: block;
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
}

.div-grab-result-row {
    display: flex;
    width: 100%;
    max-width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-result-item);
    padding-left: 3px;
    padding-top: 5px;
    padding-right: 3px;
    padding-bottom: 20px;
    margin-top: 0px;
    transition: background 0.2s ease, transform 0.2s ease;
    overflow: hidden;

    height: auto;
    opacity: 1;
}

.div-grab-result-row.inprogress {
    color: var(--text-muted);
}

.div-grab-result-row.success {
    color: var(--text-primary);
}

.result-avatar {
    position: relative;
    display: inline-block;
}

.img-avatar {
    width: 30px;
    height: 30px;

    /* Make the image circular */
    border-radius: 50%;

    /* Preserve aspect ratio and fill the circle */
    object-fit: cover;

    /* Prevent inline image gaps */
    display: block;

    transition: filter 0.25s;
}

.div-grab-result-row.inprogress .img-avatar {
  filter: brightness(0.6);
}

.avatar-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    /* transform: translate(-50%, -50%) scale(0.9); */
    transform: translate(-50%, -50%) scale(1);

    width: 32px;
    height: 32px;

    font-size: 28px;   /* controls SVG size */

    color: var(--avatar-play-btn);;

    border-radius: 50%;
    border: none;
    background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    opacity: 1;
    transition: all 0.25s ease;

    -webkit-tap-highlight-color: transparent;
}

.avatar-play-btn:focus {
    outline: none;
}

.avatar-play-btn svg {
    width: 1em;
    height: 1em;
    filter:
        drop-shadow(0 0 3px rgba(0,0,0,1))
        drop-shadow(0 0 6px rgba(0,0,0,0.9));
}

/* Hover effect: show play button */
.result-avatar:hover .avatar-play-btn {
    color: var(--avatar-play-btn-hover);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    background: rgba(0, 0, 0, 0.7);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Optional: circular ripple effect on click */
.avatar-play-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
    background: rgba(0, 0, 0, 0.8);
}

.result-media-url {
    margin-left: 5px;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-media-url a {
    color: inherit;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.result-media-url a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.result-separator {
    color: var(--text-secondary);
}

.result-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-size {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 4px;
}

.div-result-size {
    display: inline-flex;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.div-result-format {
    display: inline-flex;
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-format {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    color: inherit;
    font-weight: 500;
    background-color: var(--bg-format);
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 4px;
}

.result-format[data-format="opus"]   { color: #29b6f6; }
.result-format[data-format="mp3"]    { color: #ff7043; }
.result-format[data-format="m4a"]    { color: #26a69a; }
.result-format[data-format="flac"]   { color: #f06292; }
.result-format[data-format="mp4"]    { color: #1e88e5; }
.result-format[data-format="webm"]   { color: #7e57c2; }

.div-result-status {
    display: inline-flex;
    width: 35px;
    height: 25px;
    min-width: 35px;
    max-width: 35px;
    min-height: 25px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fade-text {
    opacity: 0;
    filter: blur(1px) brightness(1.1);
    animation: pureFadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes pureFadeIn {
    0%   { opacity: 0; filter: blur(1px) brightness(1.1); }
    60%  { opacity: 1; filter: blur(0) brightness(1.05); }
    100% { opacity: 1; filter: blur(0) brightness(1); }
}

.item-result-spinner {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 15px;
    height: 15px;
    border: 5px solid var(--spinner-light);
    border-top: 5px solid var(--spinner-dl-start);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    pointer-events: none;
}

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

.item-result-spinner.start {
    border-top-color: var(--spinner-dl-start);
}

.item-result-spinner.downloading {
    width: 21px;
    height: 21px;
    border-width: 2px;
    border-top-width: 2px;
    border-top-color: var(--spinner-dl-downloading);
}

.item-result-spinner.finish {
    width: 15px;
    height: 15px;
    border-width: 4px;
    border-top-width: 4px;
    border-top-color: var(--spinner-dl-finish);
    border-right-color: var(--spinner-dl-downloading);
    border-bottom-color: #e74c3c;
    border-left-color: #f39c12;
    filter: brightness(0.8);
    animation: spin 2s linear infinite;
}

@keyframes spin-and-pulse {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) scale(0.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.result-progress-percent {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--spinner-dl-downloading);
    font-weight: 600;
    pointer-events: none;
}

.result-download-link {
    color: var(--download);
    font-weight: 600;
    text-decoration: none;
}

.result-download-link .icon-download {
    transition: transform .25s ease;
}

.result-download-link:hover .icon-download {
    transform: scale(1.2);
}

.icon-download {
    width: 25px;
    height: 25px;
}

.icon-download path {
    fill: var(--download);
}

.result-info-failed {
    color: var(--error);
    font-weight: 600;
}

.result-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background-color: var(--bg-result);
    box-shadow: 0 2px 6px var(--shadow);
    color: var(--text-primary);
    font-family: "Inter", "Segoe UI", sans-serif;
    font-size: 16px;
    font-weight: 500;
    width: fit-content;
    margin-top: 25px;
}

.result-loading-text {
    color: var(--text-secondary);
    letter-spacing: 0.4px;
    user-select: none;
}

.icon-download-wait {
    width: 25px;
    height: 25px;
}

.icon-download-wait path {
    fill: var(--text-muted);
}

.icon-download-failed {
    width: 25px;
    height: 25px;
}

.icon-download-failed path {
    fill: var(--error);
}

.icon-download-delete {
    width: 20px;
    height: 20px;
}

.btn-delete-row {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto;
    height: auto;
}

.btn-delete-row svg {
    pointer-events: none;
    color: var(--download-delete);
    transition: transform .25s ease;
}

.btn-delete-row:hover svg {
    color: var(--download-delete-hover);
    transform: scale(1.2);
}

.btn-download-repeat {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto;
    height: auto;
}

.btn-download-repeat svg {
    pointer-events: none;
    color: var(--download-repeat);
    transition: transform .3s ease;
    font-size: 24px;
}

.btn-download-repeat:hover svg {
    color: var(--download-repeat-hover);
    transform: scale(1.1) rotate(360deg);
}

@media (max-width: 768px) {
    .div-grab-result-row {
        width: 100%;
    }
}

@media (max-width: 580px) {
    .result-rows {
        padding: 5px 10px;
        border: 1px solid var(--border-result);
        border-radius: 15px;
        box-shadow: 0 1px 3px var(--shadow);
    }

    .result-toolbar {
        margin-top: 10px;
    }

    .history-search {
        display: flex;
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        padding: 0;
    }

    .history-search__wrapper {
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
    }

    .history-search__input {
        width: 150px;
        max-width: 100%;
        margin-left: auto;
    transition:
        border-color 0.5s ease,
        background-color 0.5s ease,
        color 0.5s ease,
        transform 0.5s ease;
    }

    .history-search__input:focus,
    .history-search__input.has-value {
        width: 100%;
        margin-left: 0;
    }

    .div-grab-result-row {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
        padding-top: 5px;
        padding-bottom: 25px;
        gap: 10px;
    }

    .div-grab-result-row::after {
        content: "";
        position: absolute;
        bottom: 10px;
        left: 50%;
        width: 80%;
        height: 1px;
        background: var(--border-result);
        transform: translateX(-50%);
    }

    .div-result-size,
    .div-result-format,
    .div-result-status {
        width: auto;
    }

    .div-result-size {
        justify-content: right;
    }

    .result-size {
        padding: 2px 0px;
    }

    .result-left {
        display: flex;
        text-align: left;
        width: 100%;        
        gap: 6px;
    }

    .result-right {
        display: flex;
        justify-content: center;
        gap: 6px;
    }

    .result-media-url {
        /* text-align: center; */
        width: 100%;
    }

    .result-separator.first {
        display: none;
    }
}
