/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.2);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--secondary-color);
    position: relative;
    overflow-x: hidden;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: -2;
}

.background-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.3) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-20px) translateY(-10px); }
    50% { transform: translateX(20px) translateY(10px); }
    75% { transform: translateX(-10px) translateY(20px); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 50px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-medium);
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.logo-icon {
    position: relative;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-color), #c0392b);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.logo-icon i {
    font-size: 2.5rem;
    color: white;
    z-index: 2;
}

.logo-shine {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
    transform: rotate(45deg);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
    100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}

.logo-text {
    text-align: left;
}

.logo-text h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--white), #f8f9fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1.1;
}

.version {
    background: linear-gradient(135deg, var(--success-color), #229954);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-light);
}

.header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin-bottom: 25px;
    font-weight: 500;
}

.feature-badges {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
    cursor: pointer;
}

.badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    background: rgba(255, 255, 255, 0.25);
}

.badge-security i { color: #27ae60; }
.badge-speed i { color: #f39c12; }
.badge-mobile i { color: #3498db; }
.badge-quality i { color: #e74c3c; }

/* Upload Section */
.upload-section {
    max-width: 800px;
    margin: 0 auto 50px;
}

.upload-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: var(--transition);
}

.upload-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.upload-area {
    background: transparent;
    border: 3px dashed #bdc3c7;
    border-radius: var(--border-radius);
    padding: 60px 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    margin: 20px;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.upload-area:hover {
    border-color: var(--primary-color);
    color: white;
}

.upload-area:hover::before {
    opacity: 0.1;
}

.upload-area.dragover {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.1));
    transform: scale(1.02);
    box-shadow: inset 0 0 20px rgba(231, 76, 60, 0.2);
}

.upload-icon {
    position: relative;
    margin-bottom: 25px;
    display: inline-block;
}

.upload-area i {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: block;
    animation: float 4s ease-in-out infinite;
    transition: var(--transition);
}

.upload-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 80%;
    right: 20%;
    animation-delay: 1s;
}

.particle:nth-child(3) {
    bottom: 20%;
    left: 50%;
    animation-delay: 2s;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.7; }
    50% { transform: translateY(-20px) scale(1.2); opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

.upload-area h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-weight: 700;
    transition: var(--transition);
}

.upload-area:hover h3 {
    color: white;
}

.upload-area p {
    color: #7f8c8d;
    margin-bottom: 35px;
    font-size: 1rem;
    transition: var(--transition);
}

.upload-area:hover p {
    color: rgba(255, 255, 255, 0.9);
}

.upload-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.upload-area:hover .feature-item {
    color: rgba(255, 255, 255, 0.9);
}

.feature-item i {
    color: var(--success-color);
    font-size: 1.1rem;
    transition: var(--transition);
}

/* Main Content */
.main-content {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.pdf-viewer {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.pdf-viewer:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.viewer-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-header h2 i {
    color: #3498db;
}

.view-controls {
    display: flex;
    gap: 10px;
}

.file-info {
    display: flex;
    align-items: center;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid #ecf0f1;
}

.file-details i {
    color: #e74c3c;
    font-size: 1.5rem;
}

.file-details div {
    display: flex;
    flex-direction: column;
}

.file-details span {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.file-details small {
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Pages Grid */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
}

.page-item {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    overflow: hidden;
}

.page-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.page-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-medium);
}

.page-item:hover::before {
    opacity: 0.1;
}

.page-item.selected {
    border-color: var(--accent-color);
    background: rgba(231, 76, 60, 0.1);
    transform: scale(0.95);
}

.page-item.selected::before {
    opacity: 0.2;
}

.page-item.selected::after {
    content: '✕';
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--accent-color), #c0392b);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: var(--shadow-light);
    animation: removeIcon 0.3s ease-out;
}

@keyframes removeIcon {
    0% { transform: scale(0) rotate(180deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.page-canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.page-item:hover .page-canvas {
    box-shadow: var(--shadow-medium);
}

.page-number {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Sidebar */
.sidebar {
    width: 380px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.3);
    height: fit-content;
    transition: var(--transition);
}

.sidebar:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.remove-section h3 {
    color: var(--secondary-color);
    font-size: 1.6rem;
    margin-bottom: 25px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.remove-section h3::before {
    content: '';
    width: 4px;
    height: 30px;
    background: linear-gradient(135deg, var(--accent-color), #c0392b);
    border-radius: 2px;
}

.info-box {
    background: linear-gradient(135deg, #e8f4fd, #f0f8ff);
    border: 1px solid rgba(23, 162, 184, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #17a2b8, #138496);
}

.info-box i {
    color: #17a2b8;
    margin-top: 2px;
    font-size: 1.1rem;
}

.info-box p {
    color: #0c5460;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    font-weight: 500;
}

/* Stats */
.stats {
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #ecf0f1;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item .label {
    color: #7f8c8d;
    font-weight: 500;
}

.stat-item .value {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Input Group */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    color: #bdc3c7;
    z-index: 2;
    transition: var(--transition);
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: white;
}

.input-group input:focus + .input-icon {
    color: var(--primary-color);
}

.input-group small {
    display: block;
    margin-top: 8px;
    color: #7f8c8d;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    text-transform: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled::before {
    display: none;
}

.btn-sparkle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 1px, transparent 1px);
    background-size: 10px 10px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    transition: var(--transition);
}

.btn-glow:hover .btn-sparkle {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: sparkle 0.6s ease-out;
}

@keyframes sparkle {
    0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(180deg); }
}

.btn-large {
    padding: 18px 36px;
    font-size: 1.1rem;
    border-radius: 14px;
    font-weight: 700;
}

.btn-sm {
    padding: 10px 18px;
    font-size: 0.85rem;
    border-radius: 10px;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), #1f5582);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-color), #c0392b);
    color: white;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #4e555b);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #229954);
    color: white;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.5);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.action-buttons .btn {
    flex: 1;
}

/* Download Section */
.download-section {
    border-top: 2px solid #ecf0f1;
    padding-top: 25px;
    margin-top: 25px;
    text-align: center;
}

.success-icon {
    margin-bottom: 15px;
}

.success-icon i {
    font-size: 3rem;
    color: #27ae60;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.download-section h3 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 700;
}

.download-section p {
    color: #7f8c8d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.download-info {
    background: #f8f9fa;
    border: 1px solid #ecf0f1;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.download-info i {
    color: #3498db;
}

.download-info span {
    color: #2c3e50;
    font-size: 0.9rem;
}

.download-section .btn {
    width: 100%;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.loading-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideUp 0.4s ease-out 0.1s both;
}

@keyframes slideUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.loading-content i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    color: var(--secondary-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .container {
        padding: 15px;
    }
    
    .feature-badges {
        justify-content: center;
    }
    
    .viewer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    .view-controls {
        flex-wrap: wrap;
    }
    
    .upload-features {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .logo-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .feature-badges {
        flex-direction: column;
        align-items: center;
    }
    
    .view-controls {
        width: 100%;
        justify-content: space-between;
    }
}

/* Scrollbar Styling */
.pages-grid::-webkit-scrollbar {
    width: 6px;
}

.pages-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pages-grid::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 3px;
}

.pages-grid::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}
