:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.manus-pdf-merger {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1100px;
    margin: 40px auto;
    padding: 32px;
    background: var(--bg-color);
    border-radius: 24px;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.mpm-header {
    text-align: center;
    margin-bottom: 48px;
}

.mpm-header h2 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-main);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.mpm-header h2 svg {
    color: var(--primary-color);
}

.mpm-header p {
    color: var(--text-muted);
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto;
}

.mpm-grid-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    align-items: flex-start;
}

.mpm-file-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

/* PDF Card Styles */
.mpm-file-card {
    width: 200px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mpm-file-card:active {
    cursor: grabbing;
}

.mpm-file-card.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

.mpm-card-preview-wrapper {
    width: 180px;
    height: 250px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.mpm-file-card:hover .mpm-card-preview-wrapper {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    transform: translateY(-4px);
}

.mpm-thumbnail-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 8px;
}

.mpm-card-info {
    text-align: center;
    width: 100%;
}

.mpm-card-filename {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #fff;
    padding: 4px 12px;
    border-radius: 99px;
    margin-bottom: 6px;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.mpm-card-pages {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Action Overlay on Hover */
.mpm-card-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    transition: opacity 0.2s ease;
}

.mpm-file-card:hover .mpm-card-overlay {
    opacity: 1;
}

.mpm-card-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.mpm-card-btn:hover {
    background: #f8fafc;
    transform: scale(1.1);
}

.mpm-card-btn.delete {
    color: var(--error-color);
}

.mpm-card-btn.delete:hover {
    background: #fef2f2;
    border-color: #fee2e2;
}

/* Add Card Styles */
.mpm-add-card {
    width: 180px;
    height: 250px;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f1f5f9;
}

.mpm-add-card:hover {
    border-color: var(--primary-color);
    background: #eef2ff;
    border-style: solid;
}

.mpm-add-card-inner {
    text-align: center;
}

.mpm-add-icon {
    font-size: 32px;
    color: var(--primary-color);
    background: white;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.mpm-add-card:hover .mpm-add-icon {
    transform: rotate(90deg);
    background: var(--primary-color);
    color: white;
}

.mpm-add-text {
    font-weight: 700;
    color: var(--text-main);
    font-size: 15px;
}

/* Plus Separator */
.mpm-plus-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: #cbd5e1;
    font-size: 24px;
}

/* Controls */
.mpm-controls {
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.mpm-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.mpm-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mpm-btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgb(99 102 241 / 0.39);
}

.mpm-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgb(99 102 241 / 0.23);
}

.mpm-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.mpm-btn-secondary {
    background: white;
    color: var(--text-main);
    border-color: var(--border-color);
}

.mpm-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Status Messages */
.mpm-status {
    margin-top: 24px;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    display: none;
    font-weight: 600;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.mpm-status.loading { 
    display: block; 
    background: #eef2ff; 
    color: var(--primary-color); 
    border: 1px solid #e0e7ff;
}
.mpm-status.success { 
    display: block; 
    background: #f0fdf4; 
    color: var(--success-color); 
    border: 1px solid #dcfce7;
}
.mpm-status.error { 
    display: block; 
    background: #fef2f2; 
    color: var(--error-color); 
    border: 1px solid #fee2e2;
}

/* Custom Scrollbar */
.manus-pdf-merger::-webkit-scrollbar {
    width: 8px;
}
.manus-pdf-merger::-webkit-scrollbar-track {
    background: transparent;
}
.manus-pdf-merger::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.manus-pdf-merger::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
