/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #16162a;
    --bg-card: #1e1e38;
    --bg-card-hover: #252548;
    --text-primary: #f0f0ff;
    --text-secondary: #a0a0c0;
    --text-muted: #6a6a8e;
    --accent-primary: #8b5cf6;
    --accent-secondary: #6366f1;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --blue: #3b82f6;
    --border: rgba(139, 92, 246, 0.15);
    --border-hover: rgba(139, 92, 246, 0.35);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-glow: 0 0 20px var(--accent-glow);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    animation: bgShift 15s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% {
        opacity: .7
    }

    50% {
        opacity: 1
    }

    100% {
        opacity: .7
    }
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 18px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 4px;
}

.logo-icon {
    display: flex;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-4px)
    }
}

.logo h1 {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 .accent {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 6px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1 1 calc(20% - 6px);
    /* 5 items per row approx = 2 rows Total */
    min-width: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn i {
    font-size: 1.15rem;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(139, 92, 246, 0.05);
}

.tab-btn:hover i {
    transform: translateY(-2px);
    color: var(--accent-light);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Drop Zone ===== */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.05), transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-glow);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone.drag-over {
    transform: scale(1.01);
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.drop-icon {
    margin-bottom: 10px;
    opacity: 0.7;
    transition: var(--transition);
}

.drop-zone:hover .drop-icon {
    opacity: 1;
    transform: translateY(-2px);
}

.drop-zone h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.btn-browse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-browse:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.btn-browse:active {
    transform: translateY(0);
}

.btn-browse-orange {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-browse-orange:hover {
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.45);
}

.btn-browse-blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.btn-browse-blue:hover {
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.45);
}

.btn-browse-red {
    background: linear-gradient(135deg, #dc2626, #f97316);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.btn-browse-red:hover {
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.45);
}

.btn-browse-pink {
    background: linear-gradient(135deg, #a855f7, #e879f9);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.btn-browse-pink:hover {
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.45);
}

/* ===== Image Converter ===== */
.badge-img {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.05));
    color: #a855f7;
    font-size: 0.6rem;
}

.btn-pink-action {
    background: linear-gradient(135deg, #7c3aed, #a855f7, #e879f9);
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.35);
}

.btn-pink-action:hover {
    box-shadow: 0 8px 32px rgba(168, 85, 247, 0.5);
}

.img-convert-area {
    animation: slideUp 0.4s ease;
}

.img-convert-options {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.format-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.format-btn {
    padding: 5px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.format-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.format-btn.active {
    background: linear-gradient(135deg, #a855f7, #e879f9);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.3);
}

.quality-group {
    flex: 1;
    min-width: 180px;
}

.quality-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: var(--bg-card);
    border-radius: 3px;
    outline: none;
    min-width: 100px;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #e879f9);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
    transition: var(--transition);
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.img-convert-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.img-convert-list::-webkit-scrollbar {
    width: 4px;
}

.img-convert-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.img-convert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.img-convert-item:last-child {
    margin-bottom: 0;
}

.img-convert-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.img-convert-thumb {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.img-convert-info {
    flex: 1;
    min-width: 0;
}

.img-convert-name {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.img-convert-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.img-convert-arrow {
    color: var(--accent-light);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.img-convert-target {
    font-size: 0.7rem;
    font-weight: 600;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}

.img-convert-remove {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.img-convert-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ===== File List (Merge) ===== */
.file-list-container {
    margin-top: 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.file-list-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.file-list-header h3 svg {
    color: var(--accent-light);
}

.file-list-actions {
    display: flex;
    gap: 3px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-card);
    color: var(--accent-light);
    border-color: var(--border-hover);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.file-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}

.file-list::-webkit-scrollbar {
    width: 4px;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    cursor: grab;
    transition: var(--transition);
    border: 1px solid transparent;
    user-select: none;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.file-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.file-item.drag-target {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-glow);
}

.file-item-drag {
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
}

.file-item:hover .file-item-drag {
    color: var(--accent-light);
}

.file-item-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #ef4444;
}

.file-item-info {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.file-item-order {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-light);
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

.file-item-remove {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.file-item-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 8px 14px 12px;
}

/* ===== Action Buttons ===== */
.action-section {
    margin-top: 18px;
    text-align: center;
    animation: slideUp 0.4s ease;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 40px;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary), var(--accent-light));
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: none;
}


.btn-save-action {
    background: linear-gradient(135deg, #059669, #22c55e, #4ade80);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.35);
}

.btn-save-action:hover {
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.5);
}

.btn-blue-action {
    background: linear-gradient(135deg, #1d4ed8, #2563eb, #60a5fa);
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

.btn-blue-action:hover {
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5);
}

.btn-red-action {
    background: linear-gradient(135deg, #b91c1c, #dc2626, #f97316);
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.35);
}

.btn-red-action:hover {
    box-shadow: 0 8px 32px rgba(220, 38, 38, 0.5);
}

/* ===== Progress ===== */
.progress-container {
    margin-top: 18px;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.progress-bar {
    width: 100%;
    height: 5px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary), var(--accent-light));
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ===== Success ===== */
.success-container {
    margin-top: 18px;
    text-align: center;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(34, 197, 94, 0.2);
    animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-icon {
    color: var(--success);
    margin-bottom: 8px;
    animation: checkmark 0.6s ease 0.2s both;
}

@keyframes checkmark {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.success-container h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.success-container p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 26px;
    background: linear-gradient(135deg, #059669, #22c55e);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.45);
}

.btn-reset {
    padding: 11px 22px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-reset:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ===== Editor Area ===== */
.editor-area {
    animation: slideUp 0.4s ease;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
}

.editor-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-file-badge {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #ef4444;
    flex-shrink: 0;
}

.badge-word {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(37, 99, 235, 0.05));
    color: #3b82f6;
    font-size: 0.85rem;
}

.badge-pptx {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.05));
    color: #f97316;
    font-size: 0.85rem;
}

.editor-file-name {
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-file-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.editor-actions-top {
    display: flex;
    gap: 3px;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
}

.selected-count {
    font-size: 0.78rem;
    color: var(--accent-light);
    font-weight: 500;
}

.page-count-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== Pages Grid ===== */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    max-height: 480px;
    overflow-y: auto;
}

.pages-grid::-webkit-scrollbar {
    width: 4px;
}

.pages-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.page-card {
    position: relative;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    user-select: none;
}

.page-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.page-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 16px var(--accent-glow);
}

.page-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.page-card.drag-over {
    border-color: var(--warning);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}

.page-thumb {
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a4a;
    overflow: hidden;
}

.page-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-thumb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.page-thumb-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.page-info {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-number {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    gap: 1px;
}

.page-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.page-action-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-light);
}

.page-action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.page-selected-check {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    z-index: 2;
}

.page-card.selected .page-selected-check {
    display: flex;
}

.page-rotation-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--warning);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 2;
    display: none;
}

/* ===== Convert Preview (Word / PPTX) ===== */
.convert-preview {
    animation: slideUp 0.4s ease;
}

.convert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
}

.preview-content {
    background: white;
    color: #1a1a2e;
    padding: 32px 28px;
    min-height: 200px;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.7;
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
    color: #1a1a2e;
    margin: 16px 0 8px;
}

.preview-content h1 {
    font-size: 1.5rem;
}

.preview-content h2 {
    font-size: 1.25rem;
}

.preview-content h3 {
    font-size: 1.1rem;
}

.preview-content p {
    margin: 6px 0;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 8px 0;
}

.preview-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.preview-content td,
.preview-content th {
    border: 1px solid #ddd;
    padding: 6px 10px;
}

.preview-content ul,
.preview-content ol {
    margin: 6px 0;
    padding-left: 24px;
}

.preview-content::-webkit-scrollbar {
    width: 5px;
}

.preview-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Slides preview for PPTX */
.slides-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.slides-preview::-webkit-scrollbar {
    width: 4px;
}

.slides-preview::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.slide-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.slide-card canvas {
    width: 100%;
    display: block;
}

.slide-card-label {
    padding: 6px 12px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    padding-top: 24px;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== Missing Color Variants ===== */
.btn-browse-green {
    background: linear-gradient(135deg, #059669, #22c55e);
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.3);
}

.btn-browse-green:hover {
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.45);
}

.btn-browse-red {
    background: linear-gradient(135deg, #dc2626, #f97316);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.btn-browse-red:hover {
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.45);
}

.btn-green-action {
    background: linear-gradient(135deg, #047857, #059669, #22c55e) !important;
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.35);
}

.btn-green-action:hover {
    box-shadow: 0 8px 32px rgba(5, 150, 105, 0.5);
}

.btn-blue-action {
    background: linear-gradient(135deg, #1d4ed8, #2563eb, #60a5fa) !important;
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

.btn-blue-action:hover {
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5);
}

.btn-red-action {
    background: linear-gradient(135deg, #b91c1c, #dc2626, #f97316) !important;
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.35);
}

.btn-red-action:hover {
    box-shadow: 0 8px 32px rgba(220, 38, 38, 0.5);
}

.badge-word {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(37, 99, 235, 0.05));
    color: #3b82f6;
    font-size: 0.85rem;
}

.badge-pptx {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.05));
    color: #f97316;
    font-size: 0.85rem;
}

.badge-excel {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.2), rgba(5, 150, 105, 0.05));
    color: #22c55e;
    font-size: 0.85rem;
}

/* ===== Excel Sheet Tabs ===== */
.excel-sheet-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.excel-sheet-tab {
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.excel-sheet-tab:hover {
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

.excel-sheet-tab.active {
    background: rgba(5, 150, 105, 0.15);
    border-color: rgba(5, 150, 105, 0.4);
    color: #22c55e;
}

/* Excel table preview */
.excel-preview table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
}

.excel-preview th {
    background: #e8f5e9;
    font-weight: 600;
    text-align: left;
}

.excel-preview td,
.excel-preview th {
    border: 1px solid #c8e6c9;
    padding: 5px 10px;
    white-space: nowrap;
}

.excel-preview tr:nth-child(even) {
    background: #f5f5f5;
}

.excel-preview tr:hover {
    background: #e3f2fd;
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    padding-top: 24px;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .app-container {
        padding: 14px 10px;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .tab-btn {
        font-size: 0.72rem;
        padding: 8px 8px;
        gap: 4px;
    }

    .tab-btn svg {
        width: 14px;
        height: 14px;
    }

    .drop-zone {
        padding: 24px 14px;
    }

    .drop-zone h2 {
        font-size: 0.9rem;
    }

    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    .btn-action {
        padding: 11px 28px;
        font-size: 0.9rem;
    }

    .success-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .editor-header,
    .convert-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .preview-content {
        padding: 18px 14px;
    }
}

/* ===== Compress PDF ===== */
.btn-compress-action {
    background: linear-gradient(135deg, #059669, #10b981, #34d399) !important;
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35) !important;
}

.btn-compress-action:hover {
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.5) !important;
}

.compress-result {
    margin-top: 16px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
    animation: fadeInUp 0.4s ease;
}

.compress-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.compress-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.compress-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compress-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.compress-after {
    color: #10b981;
}

.compress-percent {
    color: #34d399;
    font-size: 1.3rem;
}

.compress-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.btn-insert {
    color: #10b981 !important;
}

/* ===== Author Link ===== */
.author-link {
    position: fixed;
    bottom: 16px;
    left: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0e0ff;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.25));
    border: 1px solid rgba(139, 92, 246, 0.4);
    padding: 8px 18px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    transition: var(--transition);
    z-index: 999;
}

.author-link:hover {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(99, 102, 241, 0.45));
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

/* Donate button */
.donate-link {
    position: fixed;
    bottom: 16px;
    right: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffe0e0;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(236, 72, 153, 0.25));
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 8px 18px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: var(--transition);
    z-index: 999;
    font-family: inherit;
}

.donate-link:hover {
    color: #fff;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.5), rgba(236, 72, 153, 0.45));
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Donate overlay */
.donate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.donate-overlay.active {
    display: flex;
}

.donate-modal {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: fadeInUp 0.3s ease;
}

.donate-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--danger);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1;
}

.donate-close:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.donate-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===== Merge Preview ===== */
.preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.preview-overlay.active {
    display: flex;
}

.preview-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90vw;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.3s ease;
    overflow: hidden;
}

.preview-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.preview-panel-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-pages {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.preview-pages canvas {
    max-width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.preview-page-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.file-item-thumb {
    width: 250px;
    height: 320px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-item-thumb img,
.file-item-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.file-item {
    cursor: pointer;
}

.file-item:hover {
    border-color: var(--accent-primary) !important;
}

/* ===== Zoom Controls ===== */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.zoom-select {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    outline: none;
}

.zoom-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== Btn Sign ===== */
.btn-sign:hover {
    background: rgba(139, 92, 246, 0.15) !important;
    color: var(--accent-light) !important;
    border-color: rgba(139, 92, 246, 0.4) !important;
}

/* ===== Browse Cyan & Tools ===== */
.btn-browse-cyan {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-browse-cyan:hover {
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.45);
}

.btn-browse-green {
    background: linear-gradient(135deg, #059669, #22c55e);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-browse-green:hover {
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.45);
}

.btn-browse-tools {
    background: linear-gradient(135deg, #d97706, #8b5cf6);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-browse-tools:hover {
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
}

/* ===== PDF Tools Tab ===== */
.pdftools-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.pdftools-drop-zone:hover {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.tools-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 16px;
}

.tool-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .tool-cards-grid {
        grid-template-columns: 1fr;
    }
}

.tool-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.tool-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.tool-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.tool-header-lock {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(99, 102, 241, 0.06));
}

.tool-header-split {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(59, 130, 246, 0.06));
}

.tool-header-wm {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(245, 158, 11, 0.06));
}

.tool-header-pgnum {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(16, 185, 129, 0.06));
}

.tool-card-icon {
    font-size: 1.4rem;
}

.tool-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tool-card-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.tool-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-input-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tool-input-row label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tool-label-hint {
    color: var(--text-muted);
    font-weight: 400;
}

.tool-input-wrap {
    display: flex;
    gap: 4px;
    align-items: center;
}

.tool-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: var(--transition);
}

.tool-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.tool-input-sm {
    padding: 5px 8px;
}

.tool-eye-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    opacity: 0.5;
    transition: var(--transition);
    flex-shrink: 0;
}

.tool-eye-btn:hover {
    opacity: 1;
}

.tool-split-mode {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tool-split-mode label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.tool-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.tool-card-btn {
    width: 100%;
    padding: 10px;
    border: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.tool-card-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.tool-card-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-lock {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.btn-split {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.btn-wm {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.btn-pgnum {
    background: linear-gradient(135deg, #059669, #22c55e);
}

/* ===== Signature Modal ===== */
.sig-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
}

.sig-overlay.active {
    display: flex;
}

.sig-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl);
    padding: 0;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.sig-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.sig-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.sig-canvas {
    display: block;
    width: 100%;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

.sig-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.sig-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    gap: 10px;
}

/* ===== OCR ===== */
.ocr-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

/* ===== Next Step Modal ===== */
.nextstep-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.nextstep-overlay.active {
    display: flex;
}

.nextstep-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 90%;
    max-width: 560px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 40px var(--accent-glow);
    animation: slideUp 0.35s ease;
    text-align: center;
}

.nextstep-header {
    margin-bottom: 20px;
}

.nextstep-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.nextstep-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.nextstep-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.nextstep-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 480px) {
    .nextstep-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.nextstep-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.nextstep-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.nextstep-btn-icon {
    font-size: 1.5rem;
}

.nextstep-btn-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.nextstep-close {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    padding: 8px 20px;
    cursor: pointer;
    transition: var(--transition);
}

.nextstep-close:hover {
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

/* ============================================
   PDF INLINE EDITOR (Biên soạn)
   ============================================ */

/* Override tab-content for full-width editor */
#pdfeditorTab.active {
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.pe-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.pe-tool-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pe-sep {
    width: 1px;
    height: 26px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

/* Tool buttons */
.pe-tool-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    position: relative;
}

.pe-tool-btn:hover {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

.pe-tool-btn.active {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Nav buttons (smaller, icon-only) */
.pe-nav-btn {
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    padding: 0 6px;
    font-size: 0.75rem;
    gap: 4px;
}

.pe-nav-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.pe-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Action button */
.pe-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #059669, #22c55e);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.pe-action-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.pe-close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.pe-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Color inputs */
.pe-color-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pe-color-input {
    width: 28px;
    height: 22px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.pe-color-label {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* Fill toggle */
.pe-fill-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

/* Size sliders */
.pe-size-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pe-size-wrap label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.pe-size-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 3px;
    background: var(--bg-card);
    border-radius: 2px;
    outline: none;
}

.pe-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

/* Select */
.pe-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.72rem;
    padding: 4px 6px;
    outline: none;
    cursor: pointer;
}

.pe-select option {
    background: var(--bg-card);
}

/* Page indicator */
.pe-page-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.pe-page-input {
    width: 40px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    padding: 3px 2px;
    outline: none;
}

.pe-page-input:focus {
    border-color: var(--accent-primary);
}

/* Info bar */
.pe-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.pe-filename {
    font-weight: 600;
    color: var(--text-primary);
}

.pe-fileinfo {
    color: var(--text-muted);
}

.pe-status {
    color: #22c55e;
    margin-left: auto;
    font-size: 0.7rem;
}

/* Canvas scroll area */
.pe-canvas-scroll {
    flex: 1;
    overflow: auto;
    background: #3a3a4a;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    min-height: 400px;
    position: relative;
}

/* Canvas wrapper - positions PDF + annotation canvases on top of each other */
.pe-canvas-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    border-radius: 2px;
    flex-shrink: 0;
}

.pe-pdf-canvas {
    display: block;
    border-radius: 2px;
}

.pe-annot-canvas {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 2px;
}

/* Text input overlay for text tool */
.pe-text-input {
    position: absolute;
    min-width: 120px;
    min-height: 28px;
    background: transparent;
    border: 1px dashed rgba(139, 92, 246, 0.6);
    border-radius: 2px;
    padding: 2px 4px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #1a1a1a;
    outline: none;
    resize: both;
    z-index: 100;
    line-height: 1.3;
    caret-color: #8b5cf6;
}

/* Image overlay */
.pe-img-overlay {
    position: absolute;
    border: 2px dashed #8b5cf6;
    cursor: move;
    z-index: 50;
}

.pe-img-overlay img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pe-img-handles {
    position: absolute;
    inset: 0;
}

.pe-img-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: nwse-resize;
}

.pe-handle-tl {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.pe-handle-tr {
    top: 0;
    left: 100%;
    cursor: nesw-resize;
}

.pe-handle-bl {
    top: 100%;
    left: 0;
    cursor: nesw-resize;
}

.pe-handle-br {
    top: 100%;
    left: 100%;
    cursor: nwse-resize;
}

/* Scrollbar styling */
.pe-canvas-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.pe-canvas-scroll::-webkit-scrollbar-track {
    background: #2a2a3a;
}

.pe-canvas-scroll::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

/* === Word-style Toolbar Sections === */
.pe-toolbar {
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    padding: 4px 10px;
    background: #1e1e32;
    border-bottom: 1px solid #2d2d44;
    flex-wrap: wrap;
    overflow: visible;
    flex-shrink: 0;
}

.pe-toolbar::-webkit-scrollbar {
    height: 3px;
}

.pe-toolbar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}

.pe-tool-section {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2px 8px;
    flex-shrink: 0;
}

.pe-tool-section-label {
    font-size: 9px;
    color: #9ca3af;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 2px 0 3px;
    text-align: center;
    white-space: nowrap;
    width: 100%;
    text-transform: uppercase;
}

.pe-tool-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Word-style tool buttons (icon + label) */
.pe-tool-btn {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 10px;
    min-width: 44px;
    height: 48px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
}

.pe-tool-btn:hover {
    background: rgba(167, 139, 250, 0.12);
    color: #fff;
    border-color: rgba(167, 139, 250, 0.3);
}

.pe-tool-btn.active {
    background: rgba(167, 139, 250, 0.22);
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.5);
}

.pe-tool-btn span {
    font-size: 9px;
    text-align: center;
    line-height: 1.1;
    color: inherit;
    max-width: 58px;
}

.pe-tool-btn svg {
    flex-shrink: 0;
}

/* Separator between sections */
.pe-sep {
    width: 1px;
    align-self: stretch;
    background: #3a3a50;
    margin: 4px 2px;
}

/* Color chip (compact color picker + label) */
.pe-color-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pe-color-chip input[type="color"] {
    width: 22px;
    height: 18px;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.pe-color-chip span {
    font-size: 9px;
    color: #bbb;
}

/* Style grid (two-row layout for KIỂU NÉT / CHỮ) */
.pe-style-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 0;
}

.pe-style-row {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pe-mini-label {
    font-size: 9px;
    color: #aaa;
}

.pe-mini-slider {
    width: 50px;
    height: 3px;
    accent-color: #a78bfa;
}

.pe-mini-val {
    font-size: 10px;
    color: #d1d5db;
    min-width: 14px;
    text-align: right;
}

.pe-mini-unit {
    font-size: 9px;
    color: #888;
}

/* Plus/Minus buttons */
.pe-pm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #555;
    background: rgba(255, 255, 255, 0.06);
    color: #ccc;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.pe-pm-btn:hover {
    background: rgba(167, 139, 250, 0.18);
    border-color: #a78bfa;
    color: #fff;
}

.pe-pm-btn:active {
    transform: scale(0.9);
}

/* Check pill (B / I / Rỗng toggles) */
.pe-check-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: 10px;
    color: #bbb;
    transition: all 0.15s;
}

.pe-check-pill input {
    display: none;
}

.pe-check-pill:has(input:checked) {
    background: rgba(167, 139, 250, 0.2);
    border-color: #a78bfa;
    color: #a78bfa;
}

.pe-check-pill:hover {
    border-color: #888;
}

.pe-bold-pill span {
    font-weight: 700;
    font-size: 11px;
}

.pe-italic-pill span {
    font-style: italic;
    font-size: 11px;
}

/* Font select dropdown */
.pe-font-select {
    font-size: 10px;
    padding: 2px 3px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #2a2a3e;
    color: #d1d5db;
    outline: none;
    cursor: pointer;
    max-width: 110px;
}

/* General select */
.pe-select {
    font-size: 11px;
    padding: 3px 4px;
    border-radius: 4px;
    border: 1px solid #3a3a50;
    background: #2a2a3e;
    color: #d1d5db;
    outline: none;
    cursor: pointer;
}

/* Nav buttons */
.pe-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 6px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}

.pe-nav-btn:hover {
    background: rgba(167, 139, 250, 0.12);
    color: #fff;
    border-color: rgba(167, 139, 250, 0.2);
}

/* Page indicator */
.pe-page-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #d1d5db;
}

.pe-page-input {
    width: 32px;
    text-align: center;
    background: #2a2a3e;
    border: 1px solid #3a3a50;
    border-radius: 4px;
    color: #d1d5db;
    font-size: 11px;
    padding: 2px;
}

/* Action button (Save) */
.pe-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pe-action-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

/* Close button */
.pe-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    cursor: pointer;
    transition: all 0.15s;
}

.pe-close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Theme toggle - premium pill at far right */
.pe-theme-toggle-wrap {
    display: flex;
    align-items: center;
    padding: 0 8px;
    flex-shrink: 0;
    align-self: center;
}

.pe-theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid #444;
    background: linear-gradient(135deg, #2a2a3e, #1e1e32);
    color: #d1d5db;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.25s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.pe-theme-toggle-btn:hover {
    border-color: #a78bfa;
    box-shadow: 0 2px 12px rgba(167, 139, 250, 0.25);
    transform: translateY(-1px);
}

.pe-theme-icon {
    font-size: 14px;
}

.pe-theme-text {
    font-size: 10px;
    letter-spacing: 0.03em;
}

/* Editor area layout — FULLSCREEN OVERLAY */
#peEditorArea {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #12121e;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Canvas scroll area */
.pe-canvas-scroll {
    flex: 1 1 auto;
    overflow: auto;
    background: #1a1a2e;
    min-height: 0;
}

/* Info bar */
.pe-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px;
    background: #16162a;
    border-bottom: 1px solid #2d2d44;
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
}

/* ============ LIGHT MODE ============ */
#peEditorArea.pe-light-mode {
    background: #f0f2f5;
}

#peEditorArea.pe-light-mode .pe-toolbar {
    background: #f5f5f8;
    border-bottom-color: #ddd;
}

#peEditorArea.pe-light-mode .pe-tool-section-label {
    color: #777;
}

#peEditorArea.pe-light-mode .pe-tool-btn {
    color: #444;
}

#peEditorArea.pe-light-mode .pe-tool-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #222;
    border-color: rgba(99, 102, 241, 0.2);
}

#peEditorArea.pe-light-mode .pe-tool-btn.active {
    background: rgba(99, 102, 241, 0.14);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.35);
}

#peEditorArea.pe-light-mode .pe-sep {
    background: #ddd;
}

#peEditorArea.pe-light-mode .pe-color-chip span,
#peEditorArea.pe-light-mode .pe-mini-label,
#peEditorArea.pe-light-mode .pe-mini-val,
#peEditorArea.pe-light-mode .pe-nav-btn,
#peEditorArea.pe-light-mode .pe-page-indicator {
    color: #555;
}

#peEditorArea.pe-light-mode .pe-mini-unit {
    color: #999;
}

#peEditorArea.pe-light-mode .pe-select,
#peEditorArea.pe-light-mode .pe-font-select,
#peEditorArea.pe-light-mode .pe-page-input {
    background: #fff;
    border-color: #ccc;
    color: #333;
}

#peEditorArea.pe-light-mode .pe-check-pill {
    border-color: #ccc;
    background: rgba(0, 0, 0, 0.03);
    color: #555;
}

#peEditorArea.pe-light-mode .pe-check-pill:has(input:checked) {
    background: rgba(99, 102, 241, 0.12);
    border-color: #6366f1;
    color: #6366f1;
}

#peEditorArea.pe-light-mode .pe-nav-btn:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #333;
}

#peEditorArea.pe-light-mode .pe-canvas-scroll {
    background: #e5e7eb;
}

#peEditorArea.pe-light-mode .pe-info-bar {
    background: #f5f5f8;
    border-color: #ddd;
    color: #666;
}

#peEditorArea.pe-light-mode .pe-theme-toggle-btn {
    background: linear-gradient(135deg, #f5f5f8, #e8e8f0);
    border-color: #ccc;
    color: #555;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#peEditorArea.pe-light-mode .pe-theme-toggle-btn:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.15);
}

#peEditorArea.pe-light-mode .pe-color-chip input[type="color"] {
    border-color: #bbb;
}

/* === Resize handles for selected objects === */
.pe-resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border: 1.5px solid #6366f1;
    border-radius: 2px;
    z-index: 60;
    pointer-events: auto;
}

.pe-resize-handle.pe-h-tl {
    cursor: nwse-resize;
}

.pe-resize-handle.pe-h-tr {
    cursor: nesw-resize;
}

.pe-resize-handle.pe-h-bl {
    cursor: nesw-resize;
}

.pe-resize-handle.pe-h-br {
    cursor: nwse-resize;
}

.pe-resize-handle.pe-h-t {
    cursor: ns-resize;
}

.pe-resize-handle.pe-h-b {
    cursor: ns-resize;
}

.pe-resize-handle.pe-h-l {
    cursor: ew-resize;
}

.pe-resize-handle.pe-h-r {
    cursor: ew-resize;
}

/* === Post-Save Suggestions Modal === */
.pe-save-modal {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: rgba(8, 8, 20, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pe-save-modal-inner {
    background: #16213e;
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 600px;
    width: 92%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pe-save-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.pe-save-modal-icon {
    font-size: 38px;
    line-height: 1;
}

.pe-save-modal-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.pe-save-modal-header p {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}

.pe-save-modal-tools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.pe-save-tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: inherit;
}

.pe-save-tool-card:hover {
    background: rgba(167, 139, 250, 0.14);
    border-color: rgba(167, 139, 250, 0.45);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(167, 139, 250, 0.15);
}

.pe-save-tool-icon {
    font-size: 24px;
}

.pe-save-tool-name {
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
}

.pe-save-tool-desc {
    font-size: 10px;
    color: #6b7280;
}

.pe-save-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 18px;
}

.pe-save-download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.pe-save-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.pe-save-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #9ca3af;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.pe-save-cancel-btn:hover {
    border-color: #6b7280;
    color: #fff;
}

/* ===== MOBILE RESPONSIVE: Editor Toolbar ===== */
@media (max-width: 768px) {
    .pe-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden;
        padding: 3px 6px;
        gap: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .pe-toolbar::-webkit-scrollbar {
        display: none;
    }

    .pe-tool-section {
        padding: 2px 5px;
    }

    .pe-tool-section-label {
        font-size: 7px;
        padding: 1px 0 2px;
    }

    .pe-tool-btn {
        padding: 3px 5px;
        min-width: 36px;
        height: 42px;
        font-size: 9px;
    }

    .pe-tool-btn svg {
        width: 18px;
        height: 18px;
    }

    .pe-tool-btn span {
        font-size: 7px;
        max-width: 42px;
    }

    .pe-sep {
        margin: 3px 1px;
    }

    /* Style sections compact */
    .pe-style-grid {
        gap: 2px;
    }

    .pe-style-row {
        gap: 4px;
    }

    .pe-mini-slider {
        width: 40px;
    }

    .pe-mini-label {
        font-size: 8px;
    }

    .pe-mini-val {
        font-size: 9px;
    }

    .pe-font-select {
        max-width: 80px;
        font-size: 9px;
    }

    .pe-check-pill {
        padding: 1px 4px;
        font-size: 9px;
    }

    .pe-pm-btn {
        width: 16px;
        height: 16px;
        font-size: 11px;
    }

    .pe-color-chip span {
        font-size: 8px;
    }

    .pe-color-chip input[type="color"] {
        width: 18px;
        height: 16px;
    }

    /* Nav + action buttons */
    .pe-nav-btn {
        padding: 3px 4px;
        font-size: 10px;
    }

    .pe-page-indicator {
        gap: 3px;
    }

    .pe-page-input {
        width: 28px;
        font-size: 10px;
    }

    .pe-action-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .pe-close-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    /* Theme toggle compact */
    .pe-theme-toggle-btn {
        padding: 3px 10px;
        font-size: 10px;
    }

    /* Editor area fill screen */
    .pe-editor-area {
        border-radius: 0 !important;
    }

    .pe-info-bar {
        padding: 3px 8px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .pe-toolbar {
        padding: 2px 4px;
        min-height: 50px;
    }

    .pe-tool-section {
        padding: 1px 3px;
    }

    .pe-tool-section-label {
        font-size: 6px;
        letter-spacing: 0.04em;
    }

    .pe-tool-btn {
        padding: 2px 4px;
        min-width: 30px;
        height: 38px;
        gap: 1px;
    }

    .pe-tool-btn svg {
        width: 16px;
        height: 16px;
    }

    .pe-tool-btn span {
        font-size: 6px;
        max-width: 36px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide style section labels on very small screens */
    .pe-style-row .pe-mini-label {
        display: none;
    }

    .pe-mini-slider {
        width: 30px;
    }

    .pe-font-select {
        max-width: 60px;
        font-size: 8px;
    }

    /* Even more compact nav */
    .pe-nav-btn {
        padding: 2px 3px;
        font-size: 9px;
    }

    .pe-nav-btn svg {
        width: 14px;
        height: 14px;
    }

    .pe-page-input {
        width: 24px;
        font-size: 9px;
        padding: 2px;
    }

    .pe-action-btn {
        padding: 3px 6px;
        font-size: 9px;
    }

    .pe-close-btn {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .pe-theme-toggle-wrap {
        padding: 0 4px;
    }

    .pe-theme-toggle-btn {
        padding: 2px 8px;
        font-size: 9px;
        gap: 3px;
    }

    .pe-theme-label {
        display: none;
    }
}