/* --- THEME VARIABLES (Dark = Default) --- */
:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --card-bg: #1e293b;
    --border-color: #334155;
    --button-bg: #2563eb;
    --button-hover: #3b82f6;
    --input-bg: #1e293b;
    --success-color: #51c274;
    --error-color: #ff6b6b;
    --transition: all 0.3s ease;
}

/* Light Mode (when toggled on) */
body.light-mode {
    --bg-color: #ffffff;
    --text-color: #222;
    --card-bg: #f9fbff;
    --border-color: #e1e8f5;
    --button-bg: #134074;
    --button-hover: #6389b5;
    --input-bg: #fff;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
    margin: 0;
}

/* --- AUTH CONTAINER --- */
#authContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 550px;
    padding: 50px 40px;
    transition: var(--transition);
}

.container:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

h1 {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 35px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    margin: -2px 0;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    transition: var(--transition);
    box-sizing: border-box;
    font-size: 14px;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    opacity: 0.6;
}

button {
    width: 100%;
    padding: 12px 18px;
    margin: 10px 0;
    border-radius: 8px;
    border: none;
    background: var(--button-bg);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
    letter-spacing: 0.5px;
}

button:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.toggle-form {
    text-align: center;
    margin-top: 25px;
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.9;
}

.toggle-form a {
    color: var(--button-bg);
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
    position: relative;
}

.toggle-form a:hover {
    color: var(--button-hover);
}

.toggle-form a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: var(--button-bg);
    transition: var(--transition);
}

.toggle-form a:hover::after {
    width: 100%;
}

.hidden {
    display: none !important;
}

.message {
    display: none;  /* ADD THIS LINE */
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    min-height: 20px;
    border: 1px solid;
    animation: slideDown 0.3s ease;
}

.message.error {
    background: rgba(255, 107, 107, 0.1);
    color: var(--error-color);
    border-color: var(--error-color);
}

.message.success {
    background: rgba(81, 194, 116, 0.1);
    color: var(--success-color);
    border-color: var(--success-color);
}

/* --- APP SCREEN --- */
#app {
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 0.5s ease;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.header h1 {
    margin: 0;
    flex: 1;
    min-width: 200px;
    text-align: left;
    font-size: 28px;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

#userDisplay {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
    opacity: 0.8;
    padding: 8px 16px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.logout-btn {
    background: #dc3545;
    padding: 10px 18px;
    font-size: 13px;
    width: auto;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.25);
    margin: 0;
}

.logout-btn:hover {
    background: #c82333;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.35);
}

#themeToggle {
    background: var(--button-bg);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 600;
    width: auto;
    margin: 0;
    position: fixed;
    top: 20px;
    right: 20px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
    z-index: 1000;
}

#themeToggle:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    transition: var(--transition);
    animation: slideUp 0.4s ease;
}

section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

section h2 {
    margin-top: 0;
    margin-bottom: 18px;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 700;
}

#urlInput {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    margin-bottom: 15px;
    transition: var(--transition);
    box-sizing: border-box;
}

#urlInput:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#output,
#history {
    background: rgba(0, 0, 0, 0.1);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    min-height: 20px;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
    font-size: 14px;
    line-height: 1.6;
}

#history ul {
    margin-left: 20px;
    margin-top: 10px;
    list-style: none;
}

#history li {
    margin-bottom: 12px;
    color: var(--text-color);
    padding-left: 20px;
    position: relative;
}

#history li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--button-bg);
    font-weight: bold;
}

.requirement,
.short-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    transition: var(--transition);
}

.requirement:hover,
.short-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

.requirement input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--button-bg);
}

.requirement input[type="text"],
.short-item input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    transition: var(--transition);
}

.requirement input[type="text"]:focus,
.short-item input[type="text"]:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.requirement button,
.short-item button {
    width: auto;
    padding: 8px 14px;
    font-size: 12px;
    margin: 0;
    background: #dc3545;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.requirement button:hover,
.short-item button:hover {
    background: #c82333;
}

#askExpertContainer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
    margin-bottom: 15px;
}

#question {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    transition: var(--transition);
}

#question:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#askExpertContainer button {
    width: auto;
    padding: 12px 20px;
    margin: 0;
    flex-shrink: 0;
}

#answer {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    min-height: 40px;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.6;
}

#addBtn,
#addShortBtn {
    margin-top: 12px;
    width: 100%;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
        justify-content: flex-start;
        min-height: auto;
    }

    .container {
        padding: 35px 25px;
        max-width: 100%;
        margin-top: 20px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .header {
        flex-direction: column;
        text-align: center;
        margin-bottom: 25px;
    }

    .header h1 {
        width: 100%;
        text-align: center;
        margin-bottom: 15px;
        font-size: 24px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    #userDisplay {
        width: 100%;
        margin-bottom: 10px;
    }

    #urlInput {
        width: 100%;
    }

    #askExpertContainer {
        flex-direction: column;
    }

    #question {
        width: 100%;
    }

    #askExpertContainer button {
        width: 100%;
    }

    section {
        padding: 20px;
        margin-bottom: 20px;
    }

    section h2 {
        font-size: 16px;
    }

    .requirement,
    .short-item {
        flex-wrap: wrap;
        padding: 10px;
    }

    .requirement button,
    .short-item button {
        width: 100%;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 30px 20px;
        max-width: 100%;
    }

    h1 {
        font-size: 20px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    button {
        font-size: 16px;
        padding: 14px 16px;
    }

    label {
        font-size: 12px;
    }

    #themeToggle {
        top: 15px;
        right: 15px;
        padding: 8px 12px;
        font-size: 12px;
    }
}