* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #000000 0%, #111111 50%, #000000 100%);
    height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
}

/* Professional keyframe animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes pageFlip {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateY(90deg);
        opacity: 0.5;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1);
}

.screen:not(.hidden) {
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* File Selection Screen */
#file-screen {
    background: #000000;
    color: white;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #111111, #1a1a1a);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.header h2 {
    font-size: 1.4rem;
    color: #ffffff;
    font-weight: 600;
    background: linear-gradient(45deg, #ffffff, #ff4757, #ffffff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ffffff;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.icon-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate(-50%, -50%);
}

.icon-btn:hover::before {
    width: 100%;
    height: 100%;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1) rotate(5deg);
    color: #ff4757;
}

.icon-btn:active {
    transform: scale(0.95);
}

.file-input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

.select-file-btn {
    background: rgba(255, 71, 87, 0.1);
    border: 2px dashed #ff4757;
    padding: 40px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
    color: #ff4757;
    min-width: 200px;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.select-file-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.select-file-btn:hover::before {
    left: 100%;
}

.select-file-btn:hover {
    background: rgba(255, 71, 87, 0.2);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(255, 71, 87, 0.3);
    border-color: #ff3742;
}

.select-file-btn:active {
    transform: translateY(-2px) scale(0.98);
}

.file-icon {
    width: 64px;
    height: 64px;
    color: #ff4757;
    margin-bottom: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-icon svg {
    width: 100%;
    height: 100%;
}

.header-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

.select-file-btn:hover .file-icon {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 10px rgba(255, 71, 87, 0.5));
}

/* Recent Files */
.recent-files {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    animation: fadeInUp 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}

.recent-files h3 {
    margin-bottom: 20px;
    color: #ffffff;
    font-size: 1.2rem;
    opacity: 0;
    animation: slideInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s both;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.file-item:nth-child(1) { animation-delay: 1s; }
.file-item:nth-child(2) { animation-delay: 1.1s; }
.file-item:nth-child(3) { animation-delay: 1.2s; }
.file-item:nth-child(4) { animation-delay: 1.3s; }
.file-item:nth-child(5) { animation-delay: 1.4s; }

.file-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s;
}

.file-item:hover::before {
    left: 100%;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(10px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 71, 87, 0.3);
}

.file-icon-small {
    font-size: 1.5rem;
    margin-right: 15px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 5px;
}

.file-date {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.no-files {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    padding: 20px;
}

/* PDF Viewer Screen */
#viewer-screen {
    background: linear-gradient(135deg, #000000 0%, #111111 50%, #000000 100%);
    color: white;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    background: linear-gradient(135deg, #111111, #1a1a1a);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-title {
    font-weight: 600;
    color: white;
    font-size: 1rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-container {
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    bottom: 55px;
    overflow: auto;
    background: linear-gradient(135deg, #000000 0%, #0a0a0a 50%, #000000 100%);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
    padding: 10px;
    touch-action: none;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

#pdf-canvas {
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    touch-action: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    margin: 0;
    display: block;
    cursor: inherit;
    image-rendering: auto;
    pointer-events: none;
}

#pdf-canvas:hover {
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.2);
}

.viewer-controls {
    position: fixed;
    bottom: 8px;
    left: 8px;
    transform: none;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(17, 17, 17, 0.95);
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    padding: 8px 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    min-width: 36px;
    min-height: 36px;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 71, 87, 0.3);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate(-50%, -50%);
}

.control-btn:hover::before {
    width: 100%;
    height: 100%;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.1);
    color: #ff4757;
}

.control-btn:active {
    transform: translateY(0) scale(0.95);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.control-btn:disabled:hover::before {
    width: 0;
    height: 0;
}

.control-btn:disabled:hover {
    background: none;
    color: white;
    transform: none;
}

#page-info, #zoom-level {
    color: white;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
    font-size: 0.9rem;
}

.icon-btn svg, .control-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    margin: 0 auto;
}

/* Page transition animation */
.page-changing {
    animation: pageFlip 0.5s ease-in-out;
}

/* Password Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content h3 {
    margin: 0 0 15px 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.modal-content p {
    margin: 0 0 20px 0;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    line-height: 1.5;
}

.password-input-container {
    margin-bottom: 20px;
}

#pdf-password {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#pdf-password:focus {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

#pdf-password::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.password-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.submit-btn {
    background: linear-gradient(135deg, #4a9eff, #0066cc);
    color: white;
}

.submit-btn:hover {
    background: linear-gradient(135deg, #5aa8ff, #0070dd);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.submit-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
}

.password-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animations */
.screen:not(.hidden) {
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .file-input-section {
        padding: 30px 20px;
    }

    .select-file-btn {
        padding: 30px;
        min-width: 180px;
    }

    .viewer-controls {
        padding: 6px 12px;
        gap: 8px;
        bottom: 5px;
        left: 5px;
    }

    .viewer-header {
        padding: 6px 10px;
    }

    .viewer-container {
        top: 38px;
        bottom: 50px;
        padding: 8px;
    }

    .file-title {
        max-width: 150px;
    }

    .control-btn {
        padding: 10px 12px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .viewer-controls {
        gap: 8px;
        padding: 8px 15px;
    }

    .control-btn {
        padding: 6px 8px;
        font-size: 0.9rem;
        min-width: 32px;
        min-height: 32px;
    }

    #page-info, #zoom-level {
        font-size: 0.8rem;
        min-width: 50px;
    }
}

/* Scrollbar styling */
.recent-files::-webkit-scrollbar,
.viewer-container::-webkit-scrollbar {
    width: 8px;
}

.recent-files::-webkit-scrollbar-track,
.viewer-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.recent-files::-webkit-scrollbar-thumb,
.viewer-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.recent-files::-webkit-scrollbar-thumb:hover,
.viewer-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}