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

:root {
    --primary-color: #6a5af9;
    --secondary-color: #d1d0d5;
    --background-color: #f4f4f9;
    --text-color: #333;
    --error-color: #e74c3c;
    --success-color: #2ecc71;

    /* Improved Glassmorphism Variables */
    --card-background: rgba(255, 255, 255, 0.75);
    --card-border: 1px solid rgba(255, 255, 255, 0.4);
    --shadow-color: rgba(106, 90, 249, 0.15);
    --shadow-hover: rgba(106, 90, 249, 0.3);
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    /* Animated Gradient Background */
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;

    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

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

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

#loading {
    font-size: 1.5em;
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#auth-container,
#signup-container,
#app-container {
    width: 100%;
    max-width: 600px;
    /* Slightly narrower for better readability */
    margin: 0 auto;
    background: var(--card-background);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    /* Safari support */
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: var(--card-border);
    transition: all 0.3s ease;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

h1 {
    color: var(--primary-color);
    font-size: 1.8em;
    margin: 0;
    font-weight: 700;
}

h2 {
    color: var(--primary-color);
}

nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: #666;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-btn.active,
.nav-btn:hover {
    background: rgba(106, 90, 249, 0.1);
    color: var(--primary-color);
    transform: translateY(-2px);
}

#user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#user-email {
    font-weight: 500;
    font-size: 0.9em;
    color: #555;
    margin: 0;
}

label {
    display: block;
    margin-top: 20px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 0.95em;
}

/* Modern Inputs with focus interaction */
textarea,
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 15px;
    border: 2px solid transparent;
    border-radius: 12px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02) inset;
    font-family: inherit;
    font-size: 1rem;
}

textarea:focus,
input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 4px 12px rgba(106, 90, 249, 0.1);
}

/* Fancy Buttons */
button,
.button {
    background: linear-gradient(135deg, #6a5af9 0%, #897bfb 100%);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 25px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
    width: 100%;
    /* Full width by default on mobile */
}

button:hover,
.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-hover);
    filter: brightness(1.1);
}

button:active {
    transform: translateY(0);
}

#google-login,
#google-signup {
    background: white;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
}

#google-login:hover,
#google-signup:hover {
    background: #f8f8f8;
}

#logout {
    background: transparent;
    color: var(--error-color);
    padding: 5px 10px;
    margin-top: 0;
    font-size: 0.85em;
    box-shadow: none;
    width: auto;
    border: 1px solid clearfix;
}

#logout:hover {
    background: rgba(231, 76, 60, 0.1);
    transform: none;
    box-shadow: none;
}

#change-password {
    background: transparent;
    color: var(--primary-color);
    padding: 5px 0;
    margin: 0;
    font-size: 0.85em;
    box-shadow: none;
    width: auto;
    text-decoration: underline;
}

#change-password:hover {
    transform: none;
    box-shadow: none;
    color: #5544d6;
}

/* Reflection Cards */
.reflection-card {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.reflection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.reflection-card h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.1em;
}

/* Pagination */
.page-btn {
    margin: 0 4px;
    padding: 8px 14px;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px var(--shadow-color);
}

/* Feedback Modal */
#feedback-modal .modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* NEW STYLES FROM USER FEEDBACK */

/* 1. Hide Stray Feedback Box (Modal) */
#feedback-modal {
    display: none;
    /* Ensure hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 2. Fancy Delete Button */
.delete-reflection {
    position: absolute;
    /* Needed for positioning */
    top: 15px;
    right: 15px;
    background: transparent;
    color: #ff7675;
    border: 2px solid #ff7675;
    border-radius: 8px;
    /* Squared with radius instead of circle */
    width: 32px;
    height: 32px;
    line-height: 28px;
    /* Center text vertically considering border */
    text-align: center;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    transition: all 0.3s ease;
    box-shadow: none;
}

.delete-reflection:hover {
    background: #ff7675;
    color: white;
    transform: rotate(90deg);
    /* Playful interaction */
}

/* 3. Fancy Dropdown (Select) */
#download-format {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: white;
    border: 2px solid var(--primary-color);
    padding: 10px 40px 10px 15px;
    border-radius: 25px;
    color: var(--primary-color);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236a5af9%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
    box-shadow: 0 4px 15px rgba(106, 90, 249, 0.1);
    transition: all 0.3s ease;
    margin-left: 10px;
}

#download-format:hover {
    box-shadow: 0 6px 20px rgba(106, 90, 249, 0.2);
    transform: translateY(-2px);
}

#reflections-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
}

#reflections-controls button {
    margin-top: 0;
    padding: 10px 20px;
    font-size: 0.9em;
}

/* Ensure empty state is pretty */
#reflections-list p {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    body {
        padding: 10px;
        align-items: flex-start;
        /* Better for long scrolling forms */
    }

    #app-container,
    #auth-container {
        padding: 25px 20px;
        margin-top: 20px;
        border-radius: 20px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    header>div:last-child {
        /* User info area */
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 10px;
        padding-top: 15px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    nav {
        width: 100%;
        justify-content: space-around;
        background: rgba(255, 255, 255, 0.5);
        padding: 5px;
        border-radius: 12px;
    }

    .nav-btn {
        flex: 1;
        text-align: center;
        padding: 10px;
        font-size: 0.9em;
    }

    h1 {
        font-size: 1.5em;
        /* Slightly smaller header on mobile */
        text-align: center;
        width: 100%;
    }

    button {
        padding: 16px;
        /* Larger touch target */
        margin-top: 30px;
    }

    textarea {
        font-size: 16px;
        /* Prevents auto-zoom on iPhone */
    }
}