@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined');

/* Container */
#ai-tag-gen {
    max-width: auto;
    margin: 32px auto;
    font-family: 'Roboto', Arial, sans-serif;
    background: linear-gradient(180deg, #fff 60%, #fff 100%);
    border-radius: 18px;
    box-shadow: 0 4px 32px #0033ff11;
    padding: 18px 10px 14px 10px;
}

/* Card */
.ai-tag-card {
    background: transparent;
    border-radius: 16px;
    box-shadow: none;
    padding: 0;
    position: relative;
    transition: box-shadow 0.2s;
    overflow: hidden;
}

/* Title */
.ai-tag-title {
    font-size: 1.25em;
    margin-bottom: 14px;
    font-weight: 700;
    color: #19255a;
    letter-spacing: -0.5px;
    text-align: center;
    text-shadow: 0 2px 12px #fff;
}

/* Form */
.ai-tag-form {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

#yt-title {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 10px;
    border: 1.5px solid #e3eafc;
    border-radius: 8px;
    font-size: 1em;
    outline: none;
    background: #fff;
    box-shadow: 0 1px 6px #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#yt-title:focus {
    border-color: #ff184e;
    box-shadow: 0 0 0 2px #ff184e33;
}

/* Generate Button */
#generate-tags {
    margin: 0 auto;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(90deg, #ff184e 70%, #ff003b 100%);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 1.06em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px #ff184e;
    transition: background 0.2s, box-shadow 0.2s, filter 0.2s;
    outline: none;
}
#generate-tags:focus {
    filter: brightness(1.08);
    box-shadow: 0 0 0 3px #ff184e55;
}
#generate-tags:hover {
    background: linear-gradient(90deg, #ff003b 70%, #ff184e 100%);
    box-shadow: 0 4px 16px #ff184e;
}

#generate-icon {
    font-size: 1.4em;
    margin-right: 2px;
    transition: color 0.2s;
}

/* Material Symbols */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1em;
    vertical-align: middle;
    margin-right: 2px;
    display: inline-block;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* Output Area */
#tags-output {
    margin: 16px 0 0px 0;
    min-height: 32px;
}

/* Tag List (flex wrap!) */
.ai-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 13px 13px;
    margin: 0 0 12px 0;
    justify-content: flex-start;
    align-items: flex-start;
    overflow: hidden;
}

/* Tag Chip */
.ai-tag {
    background: #fff;
    border: 1.2px solid #b3d5fa;
    border-radius: 7px;
    padding: 6px 13px 6px 9px;
    font-size: 1em;
    color: #19255a;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s, border-color 0.18s;
    box-shadow: 0 1px 4px #ff184e11;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    position: relative;
    font-weight: 500;
    max-width: 100%;
    word-break: break-all;
    /* No width: 100%! */
}

.ai-tag .material-symbols-outlined {
    font-size: 1.1em;
    margin-right: 3px;
    color: #ff184e;
    transition: color 0.2s;
}

.ai-tag:hover, .ai-tag.selected {
    background: #ff184e;
    color: #fff;
    border-color: #ff184e;
    box-shadow: 0 2px 8px #ff184e33;
}
.ai-tag:hover .material-symbols-outlined,
.ai-tag.selected .material-symbols-outlined {
    color: #fff;
}

/* Loading */
.ai-tag-loading {
    text-align: center;
    color: #607d8b;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}
.ai-tag-loading .material-symbols-outlined {
    font-size: 1.5em;
    color: #ff184e;
}

/* Error */
.ai-tag-error {
    color: #d32f2f;
    font-weight: bold;
    text-align: center;
    font-size: 1.05em;
}

/* Spin Animation */
.spin {
    animation: spin 1.1s linear infinite;
}
@keyframes spin {
    100% { transform: rotate(360deg);}
}

/* --- Copy Buttons --- */
#copy-btns {
    display: none;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}
.copy-btn {
    background: #ff184e;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 2px 8px #ff184e33;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
    outline: none;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    text-align: center;
}
.copy-btn:focus {
    filter: brightness(1.08);
    box-shadow: 0 0 0 3px #ff184e55;
}
.copy-btn:hover, .copy-btn.copied {
    background: #ff003b;
    color: #fff;
}
.copy-btn.copied {
    background: #ff184e !important;
    color: #fff !important;
}

/* --- Character Count Display --- */
#selected-char-count {
    text-align: center;
    margin-top: 8px;
    color: #19255a;
    font-weight: 500;
    font-size: 0.98em;
    background: #f5f8ff;
    border-radius: 7px;
    padding: 6px 0 4px 0;
    display: none;
    transition: background 0.2s, color 0.2s;
}
#selected-char-count strong,
#selected-char-count span {
    color: #ff184e;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 600px) {
    #ai-tag-gen { 
        max-width: 100%; 
        padding: 10px 2vw 8px 2vw;
        margin: 0;
    }
    .ai-tag-form { 
        flex-direction: column; 
        gap: 7px;
    }
    #yt-title {
        padding: 10px;
        font-size: 1rem;
    }
    .ai-tags-list { 
        gap: 8px 8px;
        justify-content: center;
    }
    .ai-tag {
        font-size: 0.98em;
        padding: 5px 10px 5px 7px;
    }
    #copy-btns {
        flex-direction: column;
        gap: 8px;
    }
    #generate-tags {
        width: 100%;
        justify-content: center;
    }
}
