@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

@keyframes gradientBG {
    0%, 100% {background-position: 0% 50%;}
    50%       {background-position: 100% 50%;}
}

@keyframes fadeIn {
    from {opacity: 0; transform: translateY(12px);}
    to   {opacity: 1; transform: translateY(0);}
}

@keyframes fillBar {
    from {width: 0%; }
    to   {width: var(--bar-width); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body {
    background: linear-gradient(-45deg, #e0d7ff, #c4b0ff, #a78bfa, #b898ef);
    animation: gradientBG 15s ease infinite;
    font-family: 'Lato', Tahoma, sans-serif;
    color: #1e1b2e;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    border: 10px solid #ede9fe;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    text-align: center;
}

h1 {
    font-size: 2rem; 
    font-weight: 700; 
    margin-bottom: 24px;
}

.mode-toggle {
    display: flex; 
    gap: 12px; 
    margin-bottom: 32px;
    justify-content: center;
}

.mode-btn {
    padding: 10px 28px;
    border: 2px solid #7c3aed;
    border-radius: 30px;
    background: transparent;
    color: #4c1d95;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.mode-btn:hover    {background: rgba(124, 58, 237, 0.12);}
.mode-btn.active   {background: #7c3aed; color: #fff;}
.mode-btn:active   {transform: scale(0.97);}

.section  {animation: fadeIn 0.3s ease; text-align: center;}
.hidden   {display: none !important;}

textarea {
    background: rgba(255,255,255,0.6);
    border: 1.5px solid #c4b5fd;
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    color: #1e1b2e;
    resize: vertical;
    width: 100%;
    max-width: 700px;
    box-sizing: border-box;
    outline: none;
    text-align: left;
}

textarea:focus {border-color: #7c3aed;}

input[type="file"] {
    background: rgba(255,255,255,0.6);
    border: 2px solid #c4b5fd;
    border-radius: 10px;
    padding: 8px;
    color: #1e1b2e;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

input[type="file"]::file-selector-button {
    background: linear-gradient(45deg, #a78bfa, #c4b0ff);
    border: 2px solid #7c3aed;
    border-radius: 20px;
    padding: 10px 24px;
    color: #4c1d95;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    outline: none;
}

input[type="file"]::file-selector-button:hover {
    background: linear-gradient(45deg, #c4b0ff, #a78bfa);
}

input[type="file"]::file-selector-button:active {
    transform: scale(0.98);
}

#imagePreview img {
    border-radius: 10px;
    border: 2px solid #c4b5fd;
    margin-top: 8px;
    max-width: 100%;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.analyze-btn {
    margin-top: 8px;
    padding: 11px 32px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.analyze-btn:hover  {background: #6d28d9;}
.analyze-btn:active {transform: scale(0.97);}

.analyze-btn.secondary {
    background: transparent;
    border: 2px solid #7c3aed;
    color: #4c1d95;
    margin-top: 24px;
}

.analyze-btn.secondary:hover {background: rgba(124, 58, 237, 0.1);}

.loading-card {
    background: rgba(255,255,255,0.6);
    border: 1.5px solid #c4b5fd;
    border-radius: 16px;
    padding: 28px;
    max-width: 500px;
    margin: 0 auto;
    backdrop-filter: blur(6px);
}

.loading-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 16px;
    border: 6px solid rgba(124, 58, 237, 0.2);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.results-card {
    background: rgba(255,255,255,0.55);
    border: 1.5px solid #c4b5fd;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    backdrop-filter: blur(6px);
    margin: 0 auto;
}

.results-card h2 {font-size: 1.4rem; font-weight: 700; margin: 0 0 24px; color: #4c1d95;}

.result-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-label {font-weight: 700; font-size: 14px; color: #5b21b6; min-width: 130px;}

.confidence-bar-wrap {
    flex: 1;
    background: rgba(196,181,253,0.4);
    border-radius: 20px;
    height: 14px;
    overflow: hidden;
    min-width: 120px;
}

.confidence-bar {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    width: 0%;
    animation: fillBar 1s ease forwards 0.2s;
}

.confidence-pct {font-weight: 700; font-size: 15px; color: #4c1d95; min-width: 40px; text-align: right;}

.result-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    background: #ede9fe;
    color: #4c1d95;
    border: 1.5px solid #c4b5fd;
}

.result-badge.ai    {background: #fce7f3; color: #9d174d; border-color: #f9a8d4;}
.result-badge.human {background: #d1fae5; color: #065f46; border-color: #6ee7b7;}