/* =========================================================
   ServBoat PDF Merger — Frontend Styles
   Version: 1.0.0
   ========================================================= */

/* ── Reset & Base ── */
.sbpm-wrap *,
.sbpm-wrap *::before,
.sbpm-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.sbpm-wrap {
    --sbpm-primary:       #4f46e5;
    --sbpm-primary-dark:  #4338ca;
    --sbpm-primary-light: #ede9fe;
    --sbpm-success:       #10b981;
    --sbpm-success-light: #d1fae5;
    --sbpm-error:         #ef4444;
    --sbpm-error-light:   #fee2e2;
    --sbpm-warning:       #f59e0b;
    --sbpm-text:          #111827;
    --sbpm-text-muted:    #6b7280;
    --sbpm-border:        #e5e7eb;
    --sbpm-bg:            #f9fafb;
    --sbpm-white:         #ffffff;
    --sbpm-radius:        14px;
    --sbpm-radius-sm:     8px;
    --sbpm-shadow:        0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --sbpm-shadow-hover:  0 4px 12px rgba(0,0,0,.1), 0 8px 32px rgba(0,0,0,.08);
    --sbpm-transition:    0.2s cubic-bezier(.4,0,.2,1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--sbpm-text);
    max-width: 820px;
    margin: 0 auto;
}

/* ── Utility ── */
.sbpm-hidden { display: none !important; }

/* ── Header ── */
.sbpm-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--sbpm-border);
}

.sbpm-header__icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sbpm-primary-light);
    color: var(--sbpm-primary);
    border-radius: 14px;
    flex-shrink: 0;
}

.sbpm-header__icon svg { width: 26px; height: 26px; }

.sbpm-header__title {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1.2;
    color: var(--sbpm-text);
    margin: 0;
}

.sbpm-header__sub {
    font-size: 15px;
    color: var(--sbpm-text-muted);
    margin-top: 4px;
}

/* ── Cards ── */
.sbpm-card {
    background: var(--sbpm-white);
    border: 1px solid var(--sbpm-border);
    border-radius: var(--sbpm-radius);
    box-shadow: var(--sbpm-shadow);
    padding: 32px;
    margin-bottom: 20px;
    transition: box-shadow var(--sbpm-transition);
}

/* ── Upload / Dropzone ── */
.sbpm-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 2px dashed var(--sbpm-border);
    border-radius: 12px;
    padding: 52px 24px;
    cursor: pointer;
    transition:
        border-color var(--sbpm-transition),
        background var(--sbpm-transition);
    position: relative;
    text-align: center;
    outline: none;
}

.sbpm-dropzone:hover,
.sbpm-dropzone:focus-visible {
    border-color: var(--sbpm-primary);
    background: var(--sbpm-primary-light);
}

.sbpm-dropzone.is-dragging {
    border-color: var(--sbpm-primary);
    background: var(--sbpm-primary-light);
    box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}

.sbpm-dropzone.is-dragging .sbpm-dropzone__icon {
    transform: translateY(-4px) scale(1.05);
}

.sbpm-dropzone__icon {
    color: var(--sbpm-primary);
    transition: transform var(--sbpm-transition);
}

.sbpm-dropzone__icon svg { width: 64px; height: 64px; }

.sbpm-dropzone__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--sbpm-text);
}

.sbpm-dropzone__sub {
    font-size: 14px;
    color: var(--sbpm-text-muted);
}

.sbpm-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.sbpm-dropzone__browse {
    margin-top: 8px;
    pointer-events: none;
}

.sbpm-limits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 12px;
    color: var(--sbpm-text-muted);
}

.sbpm-limits span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── File List Card ── */
.sbpm-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sbpm-files-header__title {
    font-size: 17px;
    font-weight: 600;
    color: var(--sbpm-text);
}

.sbpm-file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

/* ── File Item ── */
.sbpm-file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--sbpm-border);
    border-radius: 10px;
    background: var(--sbpm-bg);
    transition:
        box-shadow var(--sbpm-transition),
        background var(--sbpm-transition),
        border-color var(--sbpm-transition),
        opacity var(--sbpm-transition);
    cursor: grab;
    user-select: none;
}

.sbpm-file-item:active { cursor: grabbing; }

.sbpm-file-item.is-dragging-item {
    opacity: .5;
    background: var(--sbpm-primary-light);
    border-color: var(--sbpm-primary);
}

.sbpm-file-item.is-drag-over {
    background: var(--sbpm-primary-light);
    border-color: var(--sbpm-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.2);
}

.sbpm-file-item__drag {
    color: var(--sbpm-text-muted);
    flex-shrink: 0;
    cursor: grab;
    display: flex;
    align-items: center;
}

.sbpm-file-item__drag svg { width: 16px; height: 16px; }

.sbpm-file-item__icon {
    width: 38px;
    height: 38px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sbpm-file-item__icon svg { width: 18px; height: 18px; }

.sbpm-file-item__info {
    flex: 1;
    min-width: 0;
}

.sbpm-file-item__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sbpm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sbpm-file-item__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
}

.sbpm-file-item__size,
.sbpm-file-item__pages {
    font-size: 12px;
    color: var(--sbpm-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.sbpm-file-item__pages {
    background: var(--sbpm-primary-light);
    color: var(--sbpm-primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.sbpm-file-item__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sbpm-file-item__btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--sbpm-text-muted);
    cursor: pointer;
    transition: background var(--sbpm-transition), color var(--sbpm-transition);
}

.sbpm-file-item__btn:hover {
    background: var(--sbpm-border);
    color: var(--sbpm-text);
}

.sbpm-file-item__btn.is-delete:hover {
    background: var(--sbpm-error-light);
    color: var(--sbpm-error);
}

.sbpm-file-item__btn svg { width: 15px; height: 15px; }

/* ── Filename Row ── */
.sbpm-filename-row {
    margin-bottom: 24px;
}

.sbpm-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sbpm-text);
    margin-bottom: 8px;
}

.sbpm-filename-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
}

.sbpm-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--sbpm-border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 14px;
    color: var(--sbpm-text);
    background: var(--sbpm-bg);
    outline: none;
    transition: border-color var(--sbpm-transition);
}

.sbpm-input:focus {
    border-color: var(--sbpm-primary);
    background: var(--sbpm-white);
}

.sbpm-filename-ext {
    padding: 10px 14px;
    background: var(--sbpm-border);
    border: 1.5px solid var(--sbpm-border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    color: var(--sbpm-text-muted);
    font-weight: 600;
    white-space: nowrap;
}

/* ── Merge Row ── */
.sbpm-merge-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* ── Buttons ── */
.sbpm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition:
        background var(--sbpm-transition),
        color var(--sbpm-transition),
        box-shadow var(--sbpm-transition),
        transform var(--sbpm-transition);
    outline: none;
    white-space: nowrap;
}

.sbpm-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(79,70,229,.35);
}

.sbpm-btn--primary {
    background: var(--sbpm-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,.35);
}

.sbpm-btn--primary:hover {
    background: var(--sbpm-primary-dark);
    box-shadow: 0 4px 16px rgba(79,70,229,.45);
    transform: translateY(-1px);
}

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

.sbpm-btn--outline {
    background: transparent;
    color: var(--sbpm-primary);
    border: 1.5px solid var(--sbpm-primary);
}

.sbpm-btn--outline:hover {
    background: var(--sbpm-primary-light);
}

.sbpm-btn--ghost {
    background: transparent;
    color: var(--sbpm-text-muted);
    border: 1.5px solid var(--sbpm-border);
}

.sbpm-btn--ghost:hover {
    background: var(--sbpm-bg);
    color: var(--sbpm-text);
}

.sbpm-btn--lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 10px;
}

.sbpm-btn--sm {
    padding: 6px 14px;
    font-size: 13px;
}

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

/* ── Loading ── */
.sbpm-card--loading {
    text-align: center;
    padding: 56px 32px;
}

.sbpm-loading__title {
    font-size: 22px;
    font-weight: 700;
    margin: 20px 0 8px;
}

.sbpm-loading__sub {
    font-size: 14px;
    color: var(--sbpm-text-muted);
    margin-bottom: 28px;
}

.sbpm-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--sbpm-primary-light);
    border-top-color: var(--sbpm-primary);
    border-radius: 50%;
    animation: sbpm-spin 0.8s linear infinite;
    margin: 0 auto;
}

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

.sbpm-progress {
    height: 6px;
    background: var(--sbpm-primary-light);
    border-radius: 99px;
    overflow: hidden;
    max-width: 380px;
    margin: 0 auto;
}

.sbpm-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--sbpm-primary), #818cf8);
    border-radius: 99px;
    width: 0%;
    transition: width 0.3s ease;
    animation: sbpm-progress-indeterminate 1.6s ease-in-out infinite;
}

@keyframes sbpm-progress-indeterminate {
    0%   { transform: translateX(-100%); width: 60%; }
    100% { transform: translateX(200%);  width: 60%; }
}

/* ── Success ── */
.sbpm-card--success {
    text-align: center;
    padding: 56px 32px;
    border-color: var(--sbpm-success);
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 50%);
}

.sbpm-success__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    color: var(--sbpm-success);
    animation: sbpm-pop 0.4s cubic-bezier(.175,.885,.32,1.275);
}

.sbpm-success__icon svg { width: 80px; height: 80px; }

@keyframes sbpm-pop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.sbpm-success__title {
    font-size: 26px;
    font-weight: 700;
    color: var(--sbpm-success);
    margin-bottom: 8px;
}

.sbpm-success__sub {
    font-size: 15px;
    color: var(--sbpm-text-muted);
    margin-bottom: 28px;
}

.sbpm-success__actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Error ── */
.sbpm-card--error {
    text-align: center;
    padding: 56px 32px;
    border-color: var(--sbpm-error);
    background: linear-gradient(135deg, #fff5f5 0%, #fff 50%);
}

.sbpm-error__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    color: var(--sbpm-error);
}

.sbpm-error__icon svg { width: 72px; height: 72px; }

.sbpm-error__title {
    font-size: 22px;
    font-weight: 700;
    color: var(--sbpm-error);
    margin-bottom: 10px;
}

.sbpm-error__msg {
    font-size: 14px;
    color: var(--sbpm-text-muted);
    margin-bottom: 24px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Toast / Notification ── */
.sbpm-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.sbpm-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #1f2937;
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    pointer-events: auto;
    animation: sbpm-toast-in 0.3s ease;
    max-width: 360px;
}

.sbpm-toast.is-error  { background: var(--sbpm-error); }
.sbpm-toast.is-success{ background: var(--sbpm-success); }

@keyframes sbpm-toast-in {
    from { transform: translateX(40px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ── SEO Content ── */
.sbpm-seo {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--sbpm-border);
}

.sbpm-seo__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.sbpm-seo__card {
    background: var(--sbpm-white);
    border: 1px solid var(--sbpm-border);
    border-radius: var(--sbpm-radius);
    padding: 28px;
    box-shadow: var(--sbpm-shadow);
}

.sbpm-seo__card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--sbpm-text);
}

.sbpm-seo__card p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--sbpm-text-muted);
    margin-bottom: 12px;
}

.sbpm-seo__card p:last-child { margin-bottom: 0; }

.sbpm-seo__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.sbpm-seo__list li {
    font-size: 14px;
    color: var(--sbpm-text-muted);
    padding-left: 22px;
    position: relative;
    line-height: 1.5;
}

.sbpm-seo__list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--sbpm-success);
    font-weight: 700;
}

/* ── FAQ ── */
.sbpm-faq {
    max-width: 720px;
    margin: 0 auto;
}

.sbpm-faq__heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--sbpm-text);
    margin-bottom: 20px;
    text-align: center;
}

.sbpm-faq__item {
    border: 1px solid var(--sbpm-border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--sbpm-white);
    box-shadow: var(--sbpm-shadow);
}

.sbpm-faq__q {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--sbpm-text);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--sbpm-transition);
    outline: none;
}

.sbpm-faq__q:hover {
    background: var(--sbpm-bg);
}

.sbpm-faq__q:focus-visible {
    box-shadow: inset 0 0 0 2px var(--sbpm-primary);
}

.sbpm-faq__chevron {
    flex-shrink: 0;
    color: var(--sbpm-text-muted);
    transition: transform var(--sbpm-transition);
}

.sbpm-faq__item.is-open .sbpm-faq__chevron {
    transform: rotate(180deg);
}

.sbpm-faq__a {
    display: none;
    padding: 0 20px 18px;
}

.sbpm-faq__item.is-open .sbpm-faq__a {
    display: block;
}

.sbpm-faq__a p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--sbpm-text-muted);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .sbpm-card         { padding: 20px; }
    .sbpm-dropzone     { padding: 36px 16px; }
    .sbpm-header       { flex-direction: column; align-items: flex-start; gap: 12px; }
    .sbpm-merge-row    { flex-direction: column; align-items: stretch; }
    .sbpm-btn--lg      { width: 100%; justify-content: center; }
    .sbpm-success__actions { flex-direction: column; align-items: stretch; }
    .sbpm-success__actions .sbpm-btn { justify-content: center; }
    .sbpm-file-item    { padding: 12px; }
    .sbpm-filename-input-wrap { flex-direction: column; gap: 0; }
    .sbpm-input        { border-radius: 8px 8px 0 0; border-right: 1.5px solid var(--sbpm-border); border-bottom: none; }
    .sbpm-filename-ext { border-radius: 0 0 8px 8px; border-left: 1.5px solid var(--sbpm-border); border-top: none; text-align: center; }
    .sbpm-toast-container { left: 16px; right: 16px; bottom: 16px; }
    .sbpm-toast        { max-width: 100%; }
}

/* ── Print ── */
@media print {
    .sbpm-wrap, .sbpm-seo { display: none; }
}
