/* ==========================================================================
   Quote Share Generator — Smartcom English & EdTech
   ========================================================================== */

/* ── Tooltip ─────────────────────────────────────────────────────────────── */

#qsg-tooltip {
    position: absolute;
    z-index: 2147483646;
    display: none;
    transform: translateX(-50%);
    pointer-events: auto;
    animation: qsg-fade-in 0.15s ease-out;
}

@keyframes qsg-fade-in {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#qsg-tooltip-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #3B4AC8;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 15px;
    font-size: 11.5px;
    font-weight: 700;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    letter-spacing: 0.6px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(59,74,200,0.5), 0 1px 4px rgba(0,0,0,0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    line-height: 1;
}

#qsg-tooltip-btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(59,74,200,0.55), 0 2px 6px rgba(0,0,0,0.12); }
#qsg-tooltip-btn:active { transform: translateY(0); }

#qsg-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #3B4AC8;
}

/* ── Modal overlay ───────────────────────────────────────────────────────── */

#qsg-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8,8,24,0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px;
    box-sizing: border-box;
}

#qsg-modal.is-open {
    display: flex;
    animation: qsg-modal-in 0.2s ease-out;
}

@keyframes qsg-modal-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal inner ─────────────────────────────────────────────────────────── */

#qsg-modal-inner {
    background: #fff;
    border-radius: 18px;
    padding: 18px 20px 20px;
    max-width: 500px;
    width: 100%;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-shadow: 0 32px 80px rgba(0,0,0,0.45);
    animation: qsg-inner-in 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

#qsg-modal-inner::-webkit-scrollbar { display: none; }

@keyframes qsg-inner-in {
    from { opacity: 0; transform: scale(0.94) translateY(16px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

#qsg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#qsg-modal-title {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #1e1e2e;
    margin: 0;
    letter-spacing: 0.3px;
}

#qsg-modal-close {
    background: none;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}

#qsg-modal-close:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* ── Quote card ──────────────────────────────────────────────────────────── */

#qsg-card-wrapper {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 36px rgba(0,0,0,0.22);
    margin-bottom: 12px;
    line-height: 0;
}

#qsg-card {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 36px;
    box-sizing: border-box;
    background: #CC006E;
    min-height: 220px;
    line-height: 1.5;
    text-align: center;
}

.qsg-big-mark {
    position: absolute;
    top: 12px;
    left: 32px;
    font-size: 90px;
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    line-height: 1;
    color: rgba(255,255,255,0.18);
    user-select: none;
    pointer-events: none;
}

.qsg-quote-text {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 17px;
    line-height: 1.7;
    color: #fff;
    margin: 0 0 18px;
    position: relative;
    z-index: 1;
    word-break: break-word;
}

.qsg-divider {
    width: 44px;
    height: 2px;
    background: rgba(255,255,255,0.45);
    margin: 0 auto 13px;
    border-radius: 2px;
    flex-shrink: 0;
}

.qsg-source {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.2px;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    margin: 0;
}

.qsg-brand {
    position: absolute;
    bottom: 14px;
    right: 18px;
    display: flex;
    align-items: center;
    z-index: 2;
}

.qsg-brand img {
    height: 50px;
    width: auto;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}

/* Light-background overrides (for custom colour via settings) */
#qsg-card.qsg-light .qsg-big-mark  { color: rgba(30,30,46,0.12); }
#qsg-card.qsg-light .qsg-quote-text { color: #1e1e2e; }
#qsg-card.qsg-light .qsg-divider   { background: rgba(30,30,46,0.25); }
#qsg-card.qsg-light .qsg-source    { color: rgba(30,30,46,0.65); }
#qsg-card.qsg-light .qsg-brand img { filter: none; }

/* ── Card aspect-ratio variants ──────────────────────────────────────────── */

#qsg-card.qsg-ratio-11 { aspect-ratio: 1 / 1; min-height: unset; }
#qsg-card.qsg-ratio-45 { aspect-ratio: 4 / 5; min-height: unset; }

/* ── Controls row ────────────────────────────────────────────────────────── */

#qsg-controls-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.qsg-control-card {
    flex: 1;
    background: #f8fafc;
    border: 1.5px solid #e8edf2;
    border-radius: 14px;
    padding: 14px 16px;
}

.qsg-control-label {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.8px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 12px;
}

#qsg-palette-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qsg-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    outline: none;
    padding: 0;
    flex-shrink: 0;
}

.qsg-swatch:hover                               { transform: scale(1.18); }
.qsg-swatch--active                             { border-color: #fff !important; box-shadow: 0 0 0 3px rgba(0,0,0,0.35); transform: scale(1.1); }
.qsg-swatch[data-hex="#ffffff"]                 { border-color: #cbd5e1; }
.qsg-swatch[data-hex="#ffffff"].qsg-swatch--active { border-color: #1e1e2e !important; box-shadow: 0 0 0 3px rgba(0,0,0,0.35); }

#qsg-ratio-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.qsg-ratio-btn {
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    padding: 6px 35px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    color: #94a3b8;
    background: #fff;
    letter-spacing: 0.3px;
}

.qsg-ratio-btn:hover:not(.qsg-ratio-active) { background: #e2e8f0; color: #475569; }
.qsg-ratio-btn.qsg-ratio-active             { background: #1e1e2e; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.22); }

/* ── Download button ─────────────────────────────────────────────────────── */

#qsg-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 12px 20px;
    background: linear-gradient(90deg, #495BA8, #29205E);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 6px 20px rgba(41,32,94,0.4);
}

#qsg-download-btn:hover  { filter: brightness(1.15); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(41,32,94,0.5); }
#qsg-download-btn:active { transform: translateY(0); filter: brightness(0.92); }
#qsg-download-btn.is-loading { opacity: 0.72; pointer-events: none; cursor: default; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    #qsg-modal-inner { padding: 18px 16px 20px; border-radius: 14px; }
    #qsg-card        { padding: 40px 20px; min-height: 170px; }
    .qsg-quote-text  { font-size: 14.5px; }
    .qsg-big-mark    { font-size: 68px; }
    .qsg-source      { font-size: 9px; letter-spacing: 1.5px; }
}
