@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

body { 
    font-family: 'Inter', sans-serif; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    margin: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); 
    color: white; 
}

#app { 
    width: 90%; 
    max-width: 500px; 
    text-align: center; 
    background: rgba(255, 255, 255, 0.03); 
    padding: 40px; 
    border-radius: 24px; 
    backdrop-filter: blur(20px); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.input-wrapper { 
    position: relative; 
}

h1 { 
    font-size: 2.2rem; 
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 25px;
    text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}

textarea { 
    width: 100%; 
    height: 200px; 
    padding: 20px; 
    padding-bottom: 48px;
    border-radius: 16px; 
    border: 2px solid rgba(255,255,255,0.1); 
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 16px; 
    box-sizing: border-box; 
    resize: none;
    outline: none;
    overflow-y: auto;
}

textarea:focus { 
    border: 2px solid #38bdf8; 
}

#uploadFileBtn {
    position: absolute;
    bottom: 15px;
    left: 15px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: rgba(255,255,255,0.72);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

#uploadFileBtn:hover {
    color: #38bdf8;
    transform: scale(1.03);
    box-shadow: none;
}

#uploadFileBtn.hidden-upload {
    opacity: 0;
    pointer-events: none;
}

#wordCount { 
    position: absolute; 
    bottom: 15px; 
    right: 15px; 
    font-size: 12px; 
    font-weight: bold;
    pointer-events: none;
    transition: color 0.25s ease;
}

#wordCountNumber {
    display: inline-block;
    opacity: 1;
    transition: opacity 0.22s ease;
}

#wordCountNumber.fade-number {
    opacity: 0;
}

button { 
    margin-top: 25px; 
    padding: 14px 40px; 
    cursor: pointer; 
    border-radius: 50px; 
    background: linear-gradient(90deg, #38bdf8, #818cf8); 
    color: white; 
    border: none; 
    font-weight: bold; 
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.3s;
}

button:hover { 
    transform: scale(1.05); 
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5); 
}

.hidden { 
    display: none !important; 
}

#result-area { 
    background: rgba(255, 255, 255, 0.95); 
    color: #1e293b; 
    padding: 25px; 
    border-radius: 20px; 
    text-align: center;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-gutter: stable; 
}

textarea::-webkit-scrollbar, 
#result-area::-webkit-scrollbar,
#recentScansSidebar::-webkit-scrollbar {
    width: 12px;
}

textarea::-webkit-scrollbar-track,
#result-area::-webkit-scrollbar-track,
#recentScansSidebar::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb,
#result-area::-webkit-scrollbar-thumb,
#recentScansSidebar::-webkit-scrollbar-thumb {
    background-color: rgba(150, 150, 150, 0.3);
    border-radius: 20px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

textarea::-webkit-scrollbar-thumb:hover,
#result-area::-webkit-scrollbar-thumb:hover,
#recentScansSidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(150, 150, 150, 0.5);
}

.count-red { 
    color: #f87171; 
}

.count-green { 
    color: #34d399; 
}

#logo {
    position: fixed;
    top: 10px;
    left: 20px;
    width: 150px;
    height: 150px;
    object-fit: contain;
}

#authButton {
    position: fixed;
    top: 22px;
    right: 24px;
    z-index: 2000;
    margin: 0;
    padding: 10px 22px;
    font-size: 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

#authButton:hover {
    background: rgba(56, 189, 248, 0.18);
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(12px);
}

.auth-link-btn {
    margin-top: 10px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.auth-link-btn:hover {
    transform: none;
    box-shadow: none;
    color: #38bdf8;
    background: transparent;
}

.auth-card {
    width: 90%;
    max-width: 390px;
    position: relative;
    text-align: center;
    padding: 32px;
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}

.auth-close {
    position: absolute;
    top: 12px;
    right: 14px;
    margin: 0;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: rgba(255,255,255,0.72);
    font-size: 26px;
    line-height: 30px;
    box-shadow: none;
}

.auth-close:hover {
    color: white;
    transform: scale(1.05);
    box-shadow: none;
}

.auth-back {
    position: absolute;
    top: 12px;
    left: 14px;
    margin: 0;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: rgba(255,255,255,0.72);
    font-size: 34px;
    line-height: 26px;
    box-shadow: none;
}

.auth-back:hover {
    color: white;
    transform: scale(1.05);
    box-shadow: none;
}

#authTitle,
.auth-card h2 {
    margin: 8px 0 8px;
    font-size: 1.6rem;
}

#authSubtitle,
.auth-small-text {
    margin: 0 0 22px;
    color: rgba(255,255,255,0.72);
    font-size: 14px;
    line-height: 1.5;
}

.auth-main-btn {
    width: 100%;
    margin-top: 12px;
}

.auth-secondary-btn {
    width: 100%;
    margin-top: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: none;
}

.auth-input {
    width: 100%;
    margin-top: 10px;
    padding: 13px 14px;
    box-sizing: border-box;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    outline: none;
    background: rgba(0,0,0,0.22);
    color: white;
    font-size: 14px;
}

.auth-input:focus {
    border-color: #38bdf8;
}

.auth-divider {
    margin: 18px 0 8px;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
}

#authMessage {
    min-height: 18px;
    margin-top: 14px;
    color: #f87171;
    font-size: 13px;
    line-height: 1.4;
}

#recentScansSidebar {
    position: fixed;
    left: 24px;
    top: 260px;
    width: 230px;
    max-height: 45vh;
    overflow-y: auto;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 35px rgba(0,0,0,0.25);
    z-index: 1000;
}

#scanSearchTop {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    margin-bottom: 0;
    pointer-events: none;
    transition:
        max-height 0.28s ease,
        opacity 0.22s ease,
        transform 0.28s ease,
        margin-bottom 0.28s ease;
}

#recentScansSidebar.search-active #scanSearchTop {
    max-height: 52px;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 14px;
    pointer-events: auto;
}

#recentScansTitleRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#recentScansTitle {
    font-size: 13px;
    font-weight: bold;
    color: rgba(255,255,255,0.75);
}

.scan-search-wrapper {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

#recentScansSearch {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 38px;
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.18);
    color: white;
    font-size: 13px;
    outline: none;
}

#recentScansSearch:focus {
    border-color: #38bdf8;
}

#scanSearchBtnInside {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    line-height: 1;
    z-index: 2;
}

#scanSearchBtnInside:hover {
    transform: translateY(-50%);
    box-shadow: none;
    background: transparent;
    color: #38bdf8;
}

#scanSearchBtn {
    margin: 0;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
    color: rgba(255,255,255,0.72);
    font-size: 15px;
    line-height: 1;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

#scanSearchBtn:hover {
    color: #38bdf8;
    transform: scale(1.05);
    box-shadow: none;
    background: transparent;
}

#recentScansSidebar.search-active #scanSearchBtn {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
}

.scan-x-btn,
#backToRecentScansBtn.scan-x-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: rgba(0,0,0,0.18) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: none !important;
    color: rgba(255,255,255,0.82) !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    position: static !important;
    transition:
        background 0.18s ease,
        transform 0.18s ease,
        color 0.18s ease !important;
}

.scan-x-btn:hover,
#backToRecentScansBtn.scan-x-btn:hover {
    background: rgba(56, 189, 248, 0.16) !important;
    color: white !important;
    transform: scale(1.04) !important;
    box-shadow: none !important;
}

.scan-item {
    width: 100%;
    margin: 0 0 8px;
    padding: 12px 14px;
    text-align: left;
    border-radius: 999px;
    background: rgba(0,0,0,0.16);
    color: rgba(255,255,255,0.86);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
    box-shadow: none;
    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.scan-item:hover {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.22);
    transform: none;
    box-shadow: none;
}

#saveScanArea {
    margin-top: 18px;
}

#showSaveScanBtn {
    margin-top: 0;
    padding: 10px 24px;
    font-size: 14px;
}

#saveScanForm {
    margin-top: 12px;
}

#scanTitleInput {
    width: 100%;
    padding: 12px 14px;
    box-sizing: border-box;
    border-radius: 14px;
    border: 1px solid rgba(15,23,42,0.18);
    outline: none;
    font-size: 14px;
}

#scanTitleInput:focus {
    border-color: #38bdf8;
}

#confirmSaveScanBtn {
    margin-top: 12px;
    padding: 10px 26px;
    font-size: 14px;
}

#saveScanMessage {
    min-height: 18px;
    margin-top: 10px;
    font-size: 13px;
    color: #475569;
}

#resetMessage {
    min-height: 18px;
    margin-top: 14px;
    color: #f87171;
    font-size: 13px;
    line-height: 1.4;
}


.google-auth-btn {
    position: relative;

    width: 100%;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.google-auth-btn span {
    width: 100%;
    text-align: center;
}

.google-btn-logo {
    position: absolute;

    width: 18px;
    height: 18px;

    object-fit: contain;

    left: 90px;
    top: 49%;

    transform: translateY(-50%);
}


/* Account appearance toggle */
.appearance-setting {
    margin: 18px 0 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.appearance-label {
    margin-bottom: 10px;
    color: rgba(255,255,255,0.82);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.theme-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.theme-icon {
    font-size: 15px;
    color: rgba(255,255,255,0.72);
    line-height: 1;
}

.theme-toggle {
    position: relative;
    width: 92px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: none;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: none;
    box-shadow: none;
}

.theme-toggle-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    transition: transform 0.25s ease;
}

.theme-toggle.active {
    background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.theme-toggle.active .theme-toggle-thumb {
    transform: translateX(52px);
}

/* Light mode */
body.light-mode {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #0f172a;
}

body.light-mode #app,
body.light-mode .auth-card,
body.light-mode #recentScansSidebar {
    background: rgba(255,255,255,0.82);
    color: #0f172a;
    border-color: rgba(15,23,42,0.12);
}

body.light-mode h1 {
    color: #0f172a;
    text-shadow: none;
}

body.light-mode textarea,
body.light-mode .auth-input,
body.light-mode #recentScansSearch {
    background: rgba(255,255,255,0.92);
    color: #0f172a;
    border-color: rgba(15,23,42,0.15);
}

body.light-mode textarea::placeholder,
body.light-mode .auth-input::placeholder,
body.light-mode #recentScansSearch::placeholder {
    color: rgba(15,23,42,0.48);
}

body.light-mode #authSubtitle,
body.light-mode .auth-small-text,
body.light-mode #recentScansTitle,
body.light-mode .theme-icon,
body.light-mode .appearance-label {
    color: rgba(15,23,42,0.72);
}

body.light-mode .appearance-setting {
    border-top-color: rgba(15,23,42,0.1);
}

body.light-mode .auth-divider,
body.light-mode .auth-divider span {
    color: rgba(15,23,42,0.42);
}

body.light-mode #authButton {
    background: rgba(255,255,255,0.72);
    color: #0f172a;
    border-color: rgba(15,23,42,0.12);
}

body.light-mode .auth-secondary-btn {
    background: rgba(15,23,42,0.06);
    color: #0f172a;
    border-color: rgba(15,23,42,0.12);
}

body.light-mode .auth-close,
body.light-mode .auth-back {
    color: rgba(15,23,42,0.66);
}

body.light-mode .auth-close:hover,
body.light-mode .auth-back:hover {
    color: #0f172a;
}

body.light-mode .scan-item {
    background: rgba(15,23,42,0.05);
    color: #0f172a;
    border-color: rgba(15,23,42,0.08);
}

body.light-mode .scan-item:hover {
    background: rgba(56,189,248,0.16);
    border-color: rgba(56,189,248,0.22);
}

body.light-mode #result-area {
    background: rgba(255,255,255,0.96);
    color: #0f172a;
}

body.light-mode #scanTitleInput {
    background: rgba(255,255,255,0.92);
    color: #0f172a;
    border-color: rgba(15,23,42,0.15);
}

body.light-mode .theme-toggle {
    background: rgba(15,23,42,0.08);
    border-color: rgba(15,23,42,0.12);
}


/* Extra account spacing/divider */
.account-logout-divider {
    width: 100%;
    height: 1px;
    margin: 18px 0 18px;
    background: rgba(255,255,255,0.1);
}

body.light-mode .account-logout-divider {
    background: rgba(15,23,42,0.1);
}

/* Push logout lower when account settings are shown */
#authAccountView #logoutBtn {
    margin-top: 4px;
}

/* Light mode icon/text fixes */
body.light-mode #uploadFileBtn,
body.light-mode #scanSearchBtn,
body.light-mode #scanSearchBtnInside,
body.light-mode #backToRecentScansBtn {
    color: rgba(15,23,42,0.72) !important;
}

body.light-mode #uploadFileBtn:hover,
body.light-mode #scanSearchBtn:hover,
body.light-mode #scanSearchBtnInside:hover,
body.light-mode #backToRecentScansBtn:hover {
    color: #2563eb !important;
}
