/* ==========================================================================
   AI Copy Toolkit — Front-end styles
   All selectors are prefixed with .aict- to avoid theme conflicts.
   ========================================================================== */

/* ---- Reset / base ---- */
.aict-tool *,
.aict-tool *::before,
.aict-tool *::after {
    box-sizing: border-box;
}

/* ---- Tool container ---- */
.aict-tool {
    --aict-accent:        #5b56e8;
    --aict-accent-hover:  #4440d4;
    --aict-surface:       #ffffff;
    --aict-surface-alt:   #f7f7fb;
    --aict-border:        #e2e2ef;
    --aict-text:          #1a1a2e;
    --aict-text-muted:    #6b6b8a;
    --aict-success:       #16a34a;
    --aict-warning:       #b45309;
    --aict-danger:        #dc2626;
    --aict-radius:        10px;
    --aict-shadow:        0 2px 16px rgba(91, 86, 232, 0.09);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--aict-text);
    max-width: 820px;
    margin: 2rem auto;
    background: var(--aict-surface);
    border: 1px solid var(--aict-border);
    border-radius: var(--aict-radius);
    box-shadow: var(--aict-shadow);
    overflow: hidden;
}

/* ---- Header ---- */
.aict-tool__header {
    background: linear-gradient(135deg, var(--aict-accent) 0%, #7b76f0 100%);
    padding: 1.25rem 1.75rem;
}

.aict-tool__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

/* ---- Body ---- */
.aict-tool__body {
    padding: 1.75rem;
}

/* ---- Form ---- */
.aict-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ---- Field ---- */
.aict-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.aict-field--row {
    flex-direction: row;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.aict-field--row > * {
    flex: 1;
    min-width: 180px;
}

/* ---- Labels ---- */
.aict-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--aict-text);
}

/* ---- Inputs ---- */
.aict-input,
.aict-textarea,
.aict-select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    color: var(--aict-text);
    background: var(--aict-surface-alt);
    border: 1.5px solid var(--aict-border);
    border-radius: 7px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}

.aict-input:focus,
.aict-textarea:focus,
.aict-select:focus {
    border-color: var(--aict-accent);
    box-shadow: 0 0 0 3px rgba(91, 86, 232, 0.14);
    background: #ffffff;
}

.aict-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.aict-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%236b6b8a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* ---- Actions ---- */
.aict-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.25rem;
}

/* ---- Button ---- */
.aict-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.aict-btn--primary {
    background: var(--aict-accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(91, 86, 232, 0.3);
}

.aict-btn--primary:hover:not(:disabled) {
    background: var(--aict-accent-hover);
    box-shadow: 0 4px 14px rgba(91, 86, 232, 0.38);
    transform: translateY(-1px);
}

.aict-btn--primary:active {
    transform: translateY(0);
}

.aict-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

.aict-btn--ghost {
    background: transparent;
    color: var(--aict-accent);
    border: 1.5px solid var(--aict-accent);
    box-shadow: none;
}

.aict-btn--ghost:hover:not(:disabled) {
    background: rgba(91, 86, 232, 0.07);
}

.aict-btn--sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
}

/* ---- Spinner inside button ---- */
.aict-btn__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: aict-spin 0.65s linear infinite;
    flex-shrink: 0;
}

.aict-btn--loading .aict-btn__spinner {
    display: inline-block;
}

.aict-btn--loading .aict-btn__label {
    opacity: 0.7;
}

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

/* ---- Results area ---- */
.aict-tool__results {
    padding: 0 1.75rem 1.75rem;
}

/* ---- Loading skeleton ---- */
.aict-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    color: var(--aict-text-muted);
    font-size: 0.875rem;
}

.aict-loading__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aict-accent);
    animation: aict-pulse 1.2s ease-in-out infinite;
}
.aict-loading__dot:nth-child(2) { animation-delay: 0.2s; }
.aict-loading__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aict-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.9); }
    50%       { opacity: 1;   transform: scale(1.1); }
}

/* ---- Error message ---- */
.aict-error {
    padding: 0.9rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 7px;
    color: var(--aict-danger);
    font-size: 0.875rem;
    line-height: 1.5;
}

.aict-error strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* ---- Results header ---- */
.aict-results__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0 0.75rem;
    border-top: 1px solid var(--aict-border);
    margin-top: 0.5rem;
}

.aict-results__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--aict-text-muted);
}

/* ---- Result card ---- */
.aict-card {
    background: var(--aict-surface-alt);
    border: 1px solid var(--aict-border);
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
    position: relative;
    transition: box-shadow 0.2s;
}

.aict-card:hover {
    box-shadow: 0 2px 10px rgba(91, 86, 232, 0.1);
}

.aict-card--highlight {
    border-color: var(--aict-accent);
    background: rgba(91, 86, 232, 0.04);
}

.aict-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.aict-card__badge--a      { background: #dcfce7; color: #15803d; }
.aict-card__badge--b      { background: #e0f2fe; color: #0369a1; }
.aict-card__badge--best   { background: #fef9c3; color: #854d0e; }
.aict-card__badge--urgent { background: #fee2e2; color: #991b1b; }
.aict-card__badge--benefit { background: #dcfce7; color: #166534; }
.aict-card__badge--curiosity { background: #fce7f3; color: #9d174d; }
.aict-card__badge--social  { background: #ede9fe; color: #5b21b6; }
.aict-card__badge--command { background: #fff7ed; color: #92400e; }

.aict-card__text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--aict-text);
    margin: 0 0 0.6rem;
    word-break: break-word;
}

.aict-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.4rem;
}

.aict-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.aict-tag--score   { background: #ede9fe; color: #5b21b6; }
.aict-tag--chars   { background: #e0f2fe; color: #0369a1; }
.aict-tag--risk-low    { background: #dcfce7; color: #15803d; }
.aict-tag--risk-medium { background: #fef9c3; color: #854d0e; }
.aict-tag--risk-high   { background: #fee2e2; color: #991b1b; }
.aict-tag--lift-low    { background: #f3f4f6; color: #374151; }
.aict-tag--lift-medium { background: #dbeafe; color: #1d4ed8; }
.aict-tag--lift-high   { background: #bbf7d0; color: #065f46; }

.aict-card__reason {
    font-size: 0.8rem;
    color: var(--aict-text-muted);
    margin-top: 0.4rem;
    font-style: italic;
    line-height: 1.5;
}

.aict-card__tip {
    font-size: 0.8rem;
    color: var(--aict-text-muted);
    margin-top: 0.4rem;
    line-height: 1.5;
}

/* ---- Copy button ---- */
.aict-copy-btn {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid var(--aict-border);
    border-radius: 5px;
    cursor: pointer;
    color: var(--aict-text-muted);
    transition: all 0.15s;
    font-family: inherit;
}

.aict-copy-btn:hover {
    background: var(--aict-accent);
    border-color: var(--aict-accent);
    color: #ffffff;
}

.aict-copy-btn.copied {
    background: var(--aict-success);
    border-color: var(--aict-success);
    color: #ffffff;
}

/* ---- Pro tip banner ---- */
.aict-pro-tip {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    background: rgba(91, 86, 232, 0.05);
    border: 1px solid rgba(91, 86, 232, 0.18);
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.83rem;
    color: var(--aict-text);
    line-height: 1.55;
}

.aict-pro-tip__icon {
    flex-shrink: 0;
    font-size: 1rem;
    margin-top: 0.05rem;
}

/* ---- Best pick banner ---- */
.aict-best-pick {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #78350f;
    line-height: 1.55;
}

/* ---- FAQ items ---- */
.aict-faq-item {
    border: 1px solid var(--aict-border);
    border-radius: 8px;
    margin-bottom: 0.6rem;
    overflow: hidden;
}

.aict-faq-item__q {
    padding: 0.8rem 2.8rem 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--aict-surface-alt);
    cursor: pointer;
    position: relative;
    user-select: none;
    line-height: 1.45;
}

.aict-faq-item__q::after {
    content: "";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--aict-accent);
    border-bottom: 2px solid var(--aict-accent);
    transition: transform 0.2s;
}

.aict-faq-item.open .aict-faq-item__q::after {
    transform: translateY(-50%) rotate(-135deg);
}

.aict-faq-item__a {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--aict-text-muted);
    transition: max-height 0.3s ease, padding 0.2s;
}

.aict-faq-item.open .aict-faq-item__a {
    max-height: 300px;
    padding: 0.75rem 1rem;
}

/* ---- Schema block ---- */
.aict-schema-block {
    background: #0f172a;
    color: #7dd3fc;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 1rem;
}

/* ---- Score bar ---- */
.aict-score-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.35rem;
}

.aict-score-bar__label {
    font-size: 0.75rem;
    color: var(--aict-text-muted);
    min-width: 110px;
}

.aict-score-bar__track {
    flex: 1;
    height: 6px;
    background: var(--aict-border);
    border-radius: 3px;
    overflow: hidden;
}

.aict-score-bar__fill {
    height: 100%;
    border-radius: 3px;
    background: var(--aict-accent);
    transition: width 0.7s ease;
}

.aict-score-bar__value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--aict-accent);
    min-width: 28px;
    text-align: right;
}

/* ---- Two-column comparison ---- */
.aict-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.aict-compare__col {
    background: var(--aict-surface-alt);
    border: 1px solid var(--aict-border);
    border-radius: 8px;
    padding: 1rem;
}

.aict-compare__col--new {
    border-color: var(--aict-accent);
    background: rgba(91, 86, 232, 0.04);
}

.aict-compare__heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--aict-text-muted);
    margin-bottom: 0.6rem;
}

.aict-compare__heading--new {
    color: var(--aict-accent);
}

.aict-compare__content {
    font-size: 0.875rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Keyword / hashtag pill list ---- */
.aict-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.aict-pill {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: var(--aict-surface-alt);
    border: 1px solid var(--aict-border);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--aict-text);
}

.aict-pill--hashtag {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #5b21b6;
}

.aict-pill--keyword {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

/* ---- Issue list ---- */
.aict-issue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.aict-issue-list li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.6rem 0.8rem;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 0.83rem;
    color: #78350f;
    line-height: 1.45;
}

.aict-issue-list li::before {
    content: "⚠";
    flex-shrink: 0;
    margin-top: 0.05rem;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .aict-tool__header,
    .aict-tool__body,
    .aict-tool__results {
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }

    .aict-compare {
        grid-template-columns: 1fr;
    }

    .aict-card__text {
        padding-right: 3rem; /* room for copy btn */
    }
}
