/* ========================================
   PDF Merger - Main Stylesheet
   ======================================== */

/* CSS Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --dark-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);

    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f5576c;
    --success-color: #38ef7d;
    --warning-color: #ffc107;
    --danger-color: #dc3545;

    --bg-dark: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-glass: rgba(255, 255, 255, 0.1);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-dark: #f5f7fa;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --text-primary: #1a1a2e;
    --text-secondary: rgba(26, 26, 46, 0.7);
    --text-muted: rgba(26, 26, 46, 0.5);
    --border-color: rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--dark-gradient);
    overflow: hidden;
}

.bg-animated::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(245, 87, 108, 0.1) 0%, transparent 40%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -30px) rotate(5deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
}

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Container */
.container-custom {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Admin Login Button */
.admin-login-btn {
    position: fixed;
    top: 20px;
    right: 70px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 100;
    text-decoration: none;
}

.admin-login-btn:hover {
    background: var(--primary-gradient);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Glassmorphism Card */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: var(--transition-normal);
}

.glass-card:hover {
    box-shadow: 0 16px 48px var(--shadow-color);
    transform: translateY(-2px);
}

/* Header */
.header {
    padding: 30px 0;
    text-align: center;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 10px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 40px 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

/* Upload Area */
.upload-section {
    padding: 20px 0 60px;
}

.upload-area {
    padding: 60px 40px;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-normal);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.upload-area.drag-over {
    transform: scale(1.02);
    border-style: solid;
}

.upload-area.drag-over::before {
    opacity: 0.1;
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--bg-glass);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary-color);
    transition: var(--transition-normal);
}

.upload-area:hover .upload-icon {
    transform: scale(1.1);
    background: var(--primary-gradient);
    color: white;
}

.upload-text h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.upload-text p {
    color: var(--text-muted);
}

.upload-text .browse-btn {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

#fileInput {
    display: none;
}

/* File List */
.file-list-section {
    margin-top: 30px;
    display: none;
    padding: 0 20px;
}

.file-list-section.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.file-list-header h3 {
    font-size: 1.3rem;
}

.file-count {
    background: var(--primary-gradient);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.file-list {
    list-style: none;
    margin-bottom: 30px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 20px 20px 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: var(--transition-fast);
    cursor: grab;
    border: 1px solid transparent;
}

.file-item:hover {
    background: var(--bg-glass);
    border-color: var(--border-color);
}

.file-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.file-item.drag-over-item {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 1.2rem;
}

.file-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-order {
    width: 30px;
    height: 30px;
    background: var(--bg-glass);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.file-remove {
    width: 35px;
    height: 35px;
    border: none;
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.file-remove:hover {
    background: var(--danger-color);
    color: white;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 40px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

/* Progress Bar */
.progress-section {
    margin-top: 30px;
    display: none;
}

.progress-section.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.progress-bar-wrapper {
    background: var(--bg-card);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Result Section */
.result-section {
    margin-top: 30px;
    text-align: center;
    display: none;
}

.result-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.result-success {
    padding: 40px;
}

.result-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--success-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    animation: bounceIn 0.6s ease;
}

.result-icon.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.result-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.result-info {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        transform: scale(1.1);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 20px 0;
    }

    .logo {
        font-size: 1.5rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .hero {
        padding: 25px 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .upload-text h3 {
        font-size: 1.2rem;
    }

    .file-item {
        padding: 12px 15px;
        gap: 10px;
    }

    .file-icon {
        width: 40px;
        height: 40px;
    }

    .drag-handle {
        display: none;
    }

    .file-order {
        display: none;
    }

    .btn {
        padding: 12px 25px;
        font-size: 0.95rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .result-stats {
        gap: 20px;
    }

    .result-title {
        font-size: 1.5rem;
    }

    .result-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .glass-card {
        border-radius: 16px;
        padding: 20px;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        top: 15px;
        right: 15px;
        font-size: 1.1rem;
    }

    /* Features section */
    .features-section .glass-card {
        padding: 20px !important;
    }

    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
    }

    .toast {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .container-custom {
        padding: 0 15px;
    }

    .header {
        padding: 15px 0;
    }

    .logo {
        font-size: 1.3rem;
        gap: 8px;
    }

    .logo-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .upload-text h3 {
        font-size: 1rem;
    }

    .upload-text p {
        font-size: 0.85rem;
    }

    .file-item {
        padding: 10px 12px;
    }

    .file-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .file-name {
        font-size: 0.9rem;
    }

    .file-size {
        font-size: 0.75rem;
    }

    .file-remove {
        width: 30px;
        height: 30px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .footer {
        padding: 25px 0;
        font-size: 0.8rem;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Fix for features section Bootstrap grid on mobile */
@media (max-width: 767px) {
    .features-section .col-md-4 {
        margin-bottom: 15px;
    }

    .features-section .col-md-4:last-child {
        margin-bottom: 0;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 25px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast.success {
    background: var(--success-gradient);
}

.toast.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: var(--transition-normal);
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--primary-gradient);
    color: white;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}