:root {
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --text-primary: #E0E0E0;
    --text-secondary: #A0A0A0;
    --accent: #FFFFFF;
    --error: #CF6679;
    --success: #03DAC6;
    --border: #333333;
    --hover: #2C2C2C;
}

/* ==================== LOGIN SCREEN STYLES ==================== */

.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.login-card {
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: cardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent) 0%, rgba(255, 255, 255, 0.7) 100%);
    border-radius: 16px;
    margin-bottom: 20px;
    color: var(--bg-color);
    animation: logoPulse 3s ease-in-out infinite;
    transition: background 0.5s ease, color 0.5s ease;
}

@keyframes logoPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
    }

    50% {
        box-shadow: 0 0 20px 5px rgba(255, 255, 255, 0.15);
    }
}

.login-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    transition: color 0.5s ease;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    transition: all 0.5s ease;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-input:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.error-message {
    padding: 12px 16px;
    background: rgba(207, 102, 121, 0.15);
    border: 1px solid rgba(207, 102, 121, 0.3);
    border-radius: 10px;
    color: var(--error);
    font-size: 13px;
    text-align: center;
    animation: errorFadeIn 0.3s ease;
}

@keyframes errorFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-btn {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--bg-color);
    background: linear-gradient(135deg, var(--accent) 0%, rgba(255, 255, 255, 0.85) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(255, 255, 255, 0.3);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 32px;
    opacity: 0.6;
}

/* Light Mode Login Styles */
[data-theme='light'] .login-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

[data-theme='light'] .login-logo {
    background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
    color: white;
}

[data-theme='light'] .form-input {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme='light'] .form-input:hover {
    border-color: rgba(0, 0, 0, 0.2);
}

[data-theme='light'] .form-input:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

[data-theme='light'] .form-input::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

[data-theme='light'] .login-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
    color: white;
}

[data-theme='light'] .login-btn:hover:not(:disabled) {
    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.4);
}

/* Header Actions Container */
.header-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.logout-btn {
    color: var(--error) !important;
    border-color: var(--error) !important;
}

.logout-btn:hover {
    background: rgba(207, 102, 121, 0.15) !important;
}

/* ==================== END LOGIN STYLES ==================== */

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

/* Light Mode (formerly Ocean) */
[data-theme='light'] {
    --bg-color: #E0F2FE;
    /* Light blue ocean tint */
    --surface-color: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --accent: #3B82F6;
    --success: #10B981;
    --border: #E5E7EB;
    --hover: #F9FAFB;
    --glow: rgba(59, 130, 246, 0.15);
}

/* Dark Mode (formerly Spider) */
[data-theme='dark'] {
    --bg-color: #000000;
    --surface-color: #121212;
    --text-primary: #E5E5E5;
    --text-secondary: #A0A0A0;
    --accent: #E5E5E5;
    --success: #03DAC6;
    --border: #333333;
    --hover: #262626;
    --glow: rgba(255, 255, 255, 0.05);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 480px;
}

header {
    margin-bottom: 40px;
    text-align: center;
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    background: var(--hover);
    transform: translateY(-1px);
}

h1 {
    font-weight: 300;
    font-size: 24px;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--accent);
}

p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-area {
    background-color: var(--surface-color);
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Accentuation */
    box-shadow: 0 10px 30px -10px var(--glow);
    position: relative;
    overflow: hidden;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -12px var(--glow);
    background-color: var(--hover);
}

.icon {
    margin-bottom: 16px;
    color: var(--accent);
    opacity: 0.8;
}

.hint {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.sub-hint {
    font-size: 12px;
    opacity: 0.6;
}

/* Status & Progress */
#status-container {
    margin-top: 24px;
}

.progress-bar {
    height: 4px;
    background-color: var(--surface-color);
    /* Very subtle track, almost invisible */
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

/* Light Mode loading bar */
/* Light Mode loading bar (Liquid Shimmer) */
[data-theme='light'] .progress-fill {
    background: linear-gradient(110deg,
            var(--accent) 30%,
            #93C5FD 50%,
            var(--accent) 70%);
    background-size: 200% 100%;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    animation: liquidFlow 2s linear infinite;
}

@keyframes liquidFlow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

/* Dark Mode loading bar */
/* Dark Mode loading bar (Music Wave) */
[data-theme='dark'] .progress-fill {
    background-color: transparent;
    /* Equalizer effect using gradients */
    background-image: linear-gradient(90deg,
            transparent 50%,
            var(--accent) 50%);
    background-size: 10px 100%;
    /* Spacing of bars */
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    opacity: 0.8;
    animation: musicWave 0.5s infinite alternate;
}

/* Dissolve state for transition to background */
/* Dissolve state (Stretch & Thin) */
.progress-fill.dissolve {
    opacity: 0;
    transform: scaleX(1.5) scaleY(0.1);
    /* Stretch horizontal, thin vertical */
    transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes waveFlow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

@keyframes webCrawl {
    0% {
        background-position: 0 0, 0 0, 0 0;
    }

    100% {
        background-position: 20px 20px, 20px 20px, 40px 40px;
    }
}

@keyframes musicWave {
    0% {
        /* Low amplitude */
        clip-path: polygon(0% 40%, 10% 30%, 20% 40%, 30% 30%, 40% 40%, 50% 30%, 60% 40%, 70% 30%, 80% 40%, 90% 30%, 100% 40%, 100% 100%, 0% 100%);
    }

    100% {
        /* High amplitude */
        clip-path: polygon(0% 10%, 10% 0%, 20% 10%, 30% 0%, 40% 10%, 50% 0%, 60% 10%, 70% 0%, 80% 10%, 90% 0%, 100% 10%, 100% 100%, 0% 100%);
    }
}

.progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes waveFlow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

@keyframes webCrawl {
    0% {
        background-position: 0 0, 0 0, 0 0;
    }

    100% {
        background-position: 20px 20px, 20px 20px, 40px 40px;
    }
}

#status-text {
    text-align: center;
    font-size: 13px;
}

.hidden {
    display: none;
}

.error {
    color: var(--error);
}

.success {
    color: var(--success);
}

/* ==================== RESPONSIVE STYLES ==================== */

/* Tablets and smaller desktops */
@media screen and (max-width: 768px) {
    body {
        padding: 16px;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .container {
        max-width: 100%;
    }

    header {
        margin-bottom: 32px;
    }

    h1 {
        font-size: 20px;
    }

    .upload-area {
        padding: 48px 24px;
        border-radius: 12px;
    }

    .theme-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    #bg-canvas {
        opacity: 0.3;
    }
}

/* Mobile phones */
@media screen and (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 60px;
    }

    header {
        margin-bottom: 24px;
    }

    h1 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    p {
        font-size: 13px;
    }

    .upload-area {
        padding: 40px 20px;
        border-radius: 12px;
    }

    .upload-area:hover,
    .upload-area.drag-over {
        transform: none;
    }

    .hint {
        font-size: 14px;
    }

    .sub-hint {
        font-size: 11px;
    }

    .icon svg {
        width: 20px;
        height: 20px;
    }

    .theme-btn {
        padding: 10px 18px;
        font-size: 12px;
        border-radius: 24px;
    }

    #status-container {
        margin-top: 20px;
    }

    #status-text {
        font-size: 12px;
    }

    .progress-bar {
        height: 6px;
        border-radius: 3px;
    }

    #bg-canvas {
        opacity: 0.25;
    }
}

/* Very small phones */
@media screen and (max-width: 360px) {
    body {
        padding: 10px;
        padding-top: 40px;
    }

    h1 {
        font-size: 16px;
    }

    .upload-area {
        padding: 32px 16px;
    }

    .hint {
        font-size: 13px;
    }
}

/* Landscape on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 12px;
        padding-top: 12px;
        align-items: center;
    }

    header {
        margin-bottom: 16px;
    }

    h1 {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .upload-area {
        padding: 24px 32px;
    }

    .icon {
        margin-bottom: 10px;
    }

    .icon svg {
        width: 18px;
        height: 18px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .upload-area {
        -webkit-tap-highlight-color: transparent;
    }

    .upload-area:active {
        transform: scale(0.98);
        border-color: var(--accent);
    }

    .theme-btn:active {
        background: var(--hover);
        transform: scale(0.95);
    }
}

/* ==================== LOGIN RESPONSIVE STYLES ==================== */

/* Tablets */
@media screen and (max-width: 768px) {
    .login-card {
        padding: 40px 32px;
        border-radius: 20px;
    }

    .login-logo {
        width: 56px;
        height: 56px;
    }

    .login-title {
        font-size: 24px;
    }
}

/* Mobile phones */
@media screen and (max-width: 480px) {
    .login-screen {
        padding: 16px;
    }

    .login-card {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .login-logo {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .login-logo svg {
        width: 28px;
        height: 28px;
    }

    .login-title {
        font-size: 22px;
    }

    .login-subtitle {
        font-size: 13px;
    }

    .form-input {
        padding: 12px 14px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .login-btn {
        padding: 14px;
    }

    .login-footer {
        margin-top: 24px;
    }
}

/* Very small phones */
@media screen and (max-width: 360px) {
    .login-card {
        padding: 28px 20px;
    }

    .login-title {
        font-size: 20px;
    }

    .form-group {
        gap: 6px;
    }

    .login-form {
        gap: 16px;
    }
}

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-8px);
    }

    80% {
        transform: translateX(8px);
    }
}

/* ==================== LOGIN THEME TOGGLE ==================== */

.login-theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
}

.login-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.login-theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.moon-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* Light mode theme toggle */
[data-theme='light'] .login-theme-toggle {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
}

[data-theme='light'] .login-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme='light'] .sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme='light'] .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ==================== PASSWORD VISIBILITY TOGGLE ==================== */

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.password-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.password-toggle-btn:active {
    transform: scale(0.9);
}

.eye-icon {
    transition: all 0.25s ease;
    position: absolute;
}

.eye-open {
    opacity: 1;
    transform: scale(1);
}

.eye-closed {
    opacity: 0;
    transform: scale(0.8);
}

/* Password visible state */
.password-toggle-btn.password-visible .eye-open {
    opacity: 0;
    transform: scale(0.8);
}

.password-toggle-btn.password-visible .eye-closed {
    opacity: 1;
    transform: scale(1);
}

/* Light mode password toggle */
[data-theme='light'] .password-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Login card needs relative positioning for the theme toggle */
.login-card {
    position: relative;
}