:root {
    --primary: #2c3e50;
    --accent: #e74c3c;
    --accent-hover: #c0392b;
    --secondary: #3498db;
    --success: #27ae60;
    --success-hover: #219e50;
    --gray: #95a5a6;
    --light-gray: #ecf0f1;
    --text: #2c3e50;
    --bg-gradient: linear-gradient(135deg, #74ebd5, #9face6);
    --container-bg: white;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    --border-radius: 18px;
    --transition: all 0.3s ease;
}

body.dark-mode {
    --primary: #ecf0f1;
    --text: #ecf0f1;
    --success: #27ae60;
    --container-bg: #1E123C;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    --bg-gradient: linear-gradient(135deg, #16213e, #0f3460);
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    transition: background 0.5s;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.pdf-container {
    max-width: 100%;
    margin: auto;
    background: var(--container-bg);
    border-radius: 0;
    padding: 50px 30px;
    overflow: hidden;
    position: relative;
    transition: background 0.5s;
    color: var(--text);
    box-sizing: border-box;
}

.merge-pdf-title-suite{
    color:#e74c3ce6 !important;
}

.merge-pdf-title{
    color:#ffffff !important;
}

.theme-toggle {
    position: absolute;
    top: 5px;
    right: 35px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    user-select: none;
}

body.dark-mode .theme-toggle {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle .sun  { opacity: 1; }
.theme-toggle .moon { opacity: 0.25; }

body.dark-mode .theme-toggle .sun  { opacity: 0.25; }
body.dark-mode .theme-toggle .moon { opacity: 1; }

.tool-wrapper {
    width: 100%;
    max-width: 82rem;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 2rem;
    align-items: start;
    padding-bottom: 30px;
}

@media (min-width: 1024px) {
    .tool-wrapper {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
}

.controls {
    color: var(--text);
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    background: var(--container-bg);
}

@media (min-width: 1024px) {
    .controls {
        grid-column: span 5 / span 5;
    }
}

body.dark-mode .controls {
    border-color: rgba(255, 255, 255, 0.1);
}

/* === Calc Modes === */
.calc-mode {
    display: none;
}

.calc-mode.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mode-title {
    font-size: 1.4rem;
    color: var(--text) !important;
    margin-bottom: 8px;
    font-weight: 700;
}

.mode-description {
    color: var(--text);
    opacity: 0.7;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* === Input Groups === */
.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

/* === File Upload Area === */
.file-upload-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.file-upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition);
}

body.dark-mode .file-upload-area {
    background: rgba(255, 255, 255, 0.05);
    border-color: #555;
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: rgba(231, 76, 60, 0.05);
    transform: scale(1.02);
}

.file-upload-area.dragover {
    border-color: var(--accent);
    background: rgba(231, 76, 60, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    color: var(--accent);
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.upload-subtext {
    font-size: 0.85rem;
    color: var(--text);
    opacity: 0.6;
}

/* === File List === */
.file-list-container {
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #e5e7eb;
}

body.dark-mode .file-list-container {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.file-list-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.add-more-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.add-more-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--container-bg);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: grab;
    transition: var(--transition);
    user-select: none;
}

body.dark-mode .file-list-item {
    border-color: rgba(255, 255, 255, 0.1);
}

.file-list-item:active {
    cursor: grabbing;
}

.file-list-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.file-list-item.drag-over {
    border-color: var(--accent);
    background: rgba(231, 76, 60, 0.05);
}

.drag-handle {
    color: var(--gray);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.drag-handle span {
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.file-order-number {
    width: 22px;
    height: 22px;
    min-width: 22px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-item-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.file-item-details {
    flex-grow: 1;
    overflow: hidden;
}

.file-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-item-size {
    font-size: 0.78rem;
    color: var(--text);
    opacity: 0.55;
}

.remove-item-btn {
    background: transparent;
    color: var(--gray);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    padding: 0;
}

.remove-item-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--accent);
    transform: rotate(90deg);
}

.drag-hint {
    font-size: 0.78rem;
    color: var(--text);
    opacity: 0.45;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
}

/* === Convert Button === */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
    outline: none;
    text-decoration: none;
    line-height: 1.4;
    box-sizing: border-box;
}

.calculate-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-2px);
    background: var(--success);
    color: white;
}

.calculate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.calculate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.calculate-btn.converting {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(0.98); }
}

/* === Conversion Progress === */
.conversion-progress {
    text-align: center;
    margin-bottom: 20px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

body.dark-mode .progress-bar-container {
    background: rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--success) 0%, var(--secondary) 100%);
    border-radius: 10px;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%   { width: 10%; }
    50%  { width: 80%; }
    100% { width: 10%; }
}

.progress-text {
    color: var(--text);
    font-weight: 600;
}

/* === Result Box === */
.result-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.result-main {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.result-formula {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    font-weight: 500;
}

.result-detail {
    margin-top: 15px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: white;
    color: #667eea;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    color: #667eea;
    text-decoration: none;
}

/* === Error Box === */
.error-box {
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    align-items: center;
    gap: 15px;
}

body.dark-mode .error-box {
    background: rgba(248, 215, 218, 0.2);
    border-color: rgba(245, 198, 203, 0.3);
}

.error-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.error-message {
    color: #721c24;
    font-weight: 500;
}

body.dark-mode .error-message {
    color: #f8d7da;
}

/* === Info Display Container === */
.info-display-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

@media (min-width: 1024px) {
    .info-display-container {
        grid-column: span 7 / span 7;
    }
}

/* === Steps Grid === */
.steps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--container-bg);
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    text-align: left;
    border: 1px solid #e5e7eb;
}

body.dark-mode .step {
    border-color: rgba(255, 255, 255, 0.1);
}

.step:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: #d70932;
    color: white;
    font-weight: bold;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.step p {
    margin: 0;
    font-size: 13px;
    color: var(--text);
}

.steps-grid-mobile {
    display: none;
}

/* === Info Section === */
.info-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.info-card {
    background: var(--container-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

body.dark-mode .info-card {
    border-color: rgba(255, 255, 255, 0.1);
}

.info-card p {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text) !important;
    font-weight: 600;
}

.info-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-card li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text);
    line-height: 1.6;
}

.info-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.info-card li strong {
    color: var(--accent);
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
    .pdf-container {
        padding: 50px 0;
    }

    .controls {
        margin-top: 0;
        border: none !important;
        box-shadow: none !important;
    }

    .tool-wrapper {
        width: 95%;
        gap: 0 !important;
    }

    .result-main {
        font-size: 1.5rem;
    }

    .steps-grid {
        display: none;
    }

    .steps-grid-mobile {
        display: block !important;
        padding-bottom: 50px;
    }

    .steps-grid-mobile .step {
        margin-bottom: 16px;
    }

    .info-section {
        padding: 0 10px;
    }

    .file-upload-area {
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {
    .result-main {
        font-size: 1.3rem;
    }

    .result-formula {
        font-size: 1rem;
    }

    .download-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}