@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Lucide Icon Styling */
[data-lucide] {
    display: inline-block;
    vertical-align: middle;
    width: 1em;
    height: 1em;
    line-height: 1;
}

:root {
    --body-bg: #072D44;
    --card-bg: #D0D7E1;

    --primary-accent: #5790AB;
    --secondary-accent: #9CCDDB;
    --tertiary-dark-blue: #064469;

    --text-on-card: var(--body-bg);
    --text-subtle-on-card: var(--tertiary-dark-blue);
    --text-on-dark-bg: var(--card-bg);

    --border-dark: var(--tertiary-dark-blue);
    --border-light: var(--primary-accent);

    --shadow-dark: rgba(0, 0, 0, 0.5);
    --shadow-light-inset: rgba(0, 0, 0, 0.1);
    --error-color: #EF4444;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--body-bg);
    color: var(--text-on-card);
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
}

/* Vanta.js background container */
#vanta-bg {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: 75px;
}

/* Ensure Vanta canvas is properly positioned */
#vanta-bg canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: -1 !important;
}

#vanta-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-color: var(--body-bg);
}

.container {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 8px 30px var(--shadow-dark);
    padding: 40px;
    max-width: 800px;
    width: calc(100% - 40px);
    box-sizing: border-box;
    text-align: center;
    margin: 0px 0px 30px 0px;
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.logo-container {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 120px;
    height: auto;
    z-index: 10;

    transform-origin: 100% 0%;
    transform: rotate(15deg) translate(20px, -20px);
    opacity: 1;
}

.logo-container img {
    width: 100%;
    height: auto;
    display: block;
}

h1 {
    color: var(--text-on-card);
    margin-bottom: 10px;
    font-size: 2.8em;
    font-weight: 700;
}

.container .gradient-text {
    background: linear-gradient(to right, var(--primary-accent), var(--secondary-accent), var(--tertiary-dark-blue));
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container .underline {
    text-decoration: underline;
    text-decoration-color: var(--primary-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    font-weight: 600;
    display: inline-block;
}

p {
    color: var(--text-subtle-on-card);
    line-height: 1.7;
    margin-bottom: 25px;
}

/* Upload Area Styling */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 25px;
    border: 2px dashed var(--border-dark);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 2px 5px var(--shadow-light-inset);
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.custom-file-upload {
    border: 1px solid var(--tertiary-dark-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    cursor: pointer;
    background-color: var(--body-bg);
    color: white;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    font-weight: 600;
    font-size: 1.05em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.custom-file-upload [data-lucide] {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 10px;
}

.custom-file-upload:hover {
    background-color: var(--tertiary-dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.custom-file-upload input[type="file"] {
    display: none;
}

#file-name {
    font-size: 1em;
    color: var(--text-on-card);
    font-weight: 500;
    flex-grow: 1;
    text-align: left;
    padding-left: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Remove File Button Styling */
.remove-file-btn {
    background: none;
    border: none;
    color: var(--text-subtle-on-card);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: transform 0.2s ease, color 0.2s ease;
    margin-left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn [data-lucide] {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.remove-file-btn:hover {
    transform: scale(1.1);
    color: var(--error-color);
}

/* Summarize Button Styling */
button#summarize-btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
    background-color: var(--primary-accent);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 195px;
    margin: 20px auto 30px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button#summarize-btn [data-lucide] {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

button#summarize-btn:hover:not(:disabled) {
    background-color: var(--primary-accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

button:disabled {
    background-color: var(--border-dark);
    color: var(--text-subtle-on-card);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

button#summarize-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 238, 255, 0.705), transparent);
    transition: none;
    z-index: -1;
}

button#summarize-btn.highlight-animation::before {
    animation: slideHighlight 1s linear infinite ;
}

@keyframes slideHighlight {
    from {
        left: -100%;
    }
    to {
        left: 100%;
    }
}

/* Summary Area Styling */
.summary-area {
    text-align: left;
    margin-top: 10px;
    position: relative;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-dark);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.summary-area h2 {
    color: var(--text-on-card);
    font-size: 2em;
    margin: 0;
    padding-bottom: 10px;
}

#summary-output {
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 25px;
    padding-top: 5px;
    min-height: 180px;
    text-align: justify;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: inset 0 2px 5px var(--shadow-light-inset);
    color: var(--text-on-card);
    line-height: 1.8;
    position: relative;
    transition: min-height 0.3s ease;
}

#summary-output.loading {
    min-height: 280px;
}

#summary-output p {
    margin: 0;
    padding-top: 0;
    color: var(--text-on-card);
    text-align: center;
    line-height: 1.8;
}

/* Copy & Clear Button Base Styling */
.copy-btn, .clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    position: absolute;
    top: 10px;
    z-index: 10;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-subtle-on-card);
    font-size: 1em;
    font-weight: 500;
    border-radius: 5px;
    min-height: 28px;
    box-sizing: border-box;
}

.copy-btn {
    right: 10px;
}

.clear-btn {
    left: 10px;
}

.copy-btn [data-lucide], .clear-btn [data-lucide] {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    flex-shrink: 0;
}

#copy-text-span, #clear-text-span {
    font-size: 1.0em;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* Button Icon States */
.copy-btn [data-lucide], .clear-btn [data-lucide] {
    color: var(--text-subtle-on-card);
    transition: color 0.2s ease, transform 0.2s ease;
}

.copy-btn:hover [data-lucide] {
    color: var(--primary-accent);
    transform: translateY(-2px);
}

.clear-btn:hover [data-lucide] {
    color: var(--error-color);
    transform: translateY(-2px);
}

.copy-btn.copied [data-lucide] {
    color: var(--primary-accent);
}

/* Hide buttons by default */
.copy-btn, .clear-btn {
    display: none;
}

/* AI Lottie Loader */
.ai-loader-hidden {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

#ai-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0 20px 0;
}

#ai-loader {
    width: 300px;
    height: 300px;
    margin-bottom: 25px;
}

#loading-text {
    margin: 0;
    color: var(--text-on-card);
    font-size: 1.1em;
    font-weight: 500;
    text-align: center;
}

/* Styles for animating dots */
.animating-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
    display: inline-block;
    overflow: hidden;
    vertical-align: middle;
    width: 1em;
    font-size: 1em;
    line-height: 1;
    white-space: pre;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

.loading-message-hidden {
    display: none;
}

#ppt-loading-message {
    color: var(--text-subtle-on-card);
    font-size: 0.9em;
    margin-top: 10px;
    text-align: center;
}

.error-hidden {
    display: none;
}

#error-message {
    color: white;
    background-color: var(--error-color);
    border: 1px solid var(--error-color);
    border-radius: 8px;
    padding: 18px;
    margin-top: 25px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.footer {
    color: var(--text-on-dark-bg);
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 0.9em;
    opacity: 0.8;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.footer p {
    margin: 0;
    color: #FFFFFF;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    #vanta-bg {
        padding: 20px;
        box-sizing: border-box;
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile */
        justify-content: flex-start;
        padding-top: 30px;
        padding-bottom: 20px;
    }

    /* Optimize Vanta canvas for mobile */
    #vanta-bg canvas {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important; /* Use dynamic viewport height */
        z-index: -1 !important;
    }

    .container {
        padding: 30px;
        margin: 30px 0 20px 0;  /* No top margin, big bottom margin */
        width: 100%;
        max-width: none;
    }

    .logo-container {
        width: 80px;
        transform: rotate(15deg) translate(15px, -15px);
    }

    h1 {
        font-size: 2.2em;
        margin-bottom: 15px;
    }

    .custom-file-upload {
        text-align: center;
        box-sizing: border-box;
        width: 100%;
        padding: 12px 20px;
    }

    button#summarize-btn {
        width: 100%;
        max-width: 280px;
        margin: 20px auto 25px auto;
    }

    .file-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .upload-area {
        padding: 20px;
        margin-bottom: 25px;
    }

    #file-name {
        width: 100%;
        text-align: center;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-left: 0;
    }

    .copy-btn, .clear-btn {
        padding: 3px 8px;
        top: 8px;
        gap: 6px;
        display: none;
        min-height: 26px;
        font-size: 0.9em;
    }

    .copy-btn {
        right: 8px;
    }

    .clear-btn {
        left: 8px;
    }

    #copy-text-span, #clear-text-span {
        font-size: 0.9em;
        white-space: nowrap;
        line-height: 1;
    }

    .copy-btn [data-lucide], .clear-btn [data-lucide] {
        width: 16px;
        height: 16px;
    }

    #summary-output {
        padding: 20px;
        padding-top: 10px;
        min-height: 150px;
    }

    #summary-output.loading {
        min-height: 240px;
    }

    #ai-loader {
        width: 250px;
        height: 250px;
    }

    #ai-loader-container {
        padding: 8px 0 18px 0;
    }

    .footer {
        margin-top: 30px;
        margin-bottom: 20px;
        padding: 0 20px;
        flex-shrink: 0;
    }
}