@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --accent-color: #818cf8;
    --accent-hover: #6366f1;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    font-family: 'Outfit', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Header */
header {
    width: 100%;
    padding: 30px 0;
    text-align: center;
    background: transparent;
    margin-bottom: 20px;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(to right, #c084fc, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -1px;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 10px;
}

/* Container for Controls */
.upload-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    width: 90%;
    max-width: 600px;
    transition: transform 0.3s ease;
}

.upload-container:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.controls {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

/* Inputs & Dropdowns */
.lang-dropdown {
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    min-width: 150px;
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23818cf8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.8em;
    padding-right: 2.5rem;
}

.lang-dropdown:hover,
.lang-dropdown:focus {
    border-color: var(--accent-color);
    background-color: rgba(0, 0, 0, 0.5);
}

.custom-file-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--accent-color);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.custom-file-upload:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

input[type="file"] {
    display: none;
}

/* Viewer Area */
#viewer {
    width: 95%;
    max-width: 1200px;
    min-height: 400px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 20px;
}

.loading-text {
    color: var(--text-muted);
    font-size: 1.2rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.manga-image {
    width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    /* Vignette effect */
}

/* Text Overlays */
.text-overlay {
    position: absolute;
    background: #fff;
    /* Paper white for clean reading */
    color: #000;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    /* Slight rounding for bubbles */
    transition: transform 0.2s, box-shadow 0.2s, z-index 0s;
    user-select: text;
}

.text-overlay:hover {
    transform: scale(1.05);
    /* Pop out effect */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 100;
    cursor: text;
}

/* Page Container for PDFs */
.page-container {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}