/* public/style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f9ff;
    background-image: url(/public/bkg.png);
    background-repeat: repeat;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

body::before {
    content: "";
    /* Required for the pseudo-element to exist */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(240, 244, 245, 0.85);
    z-index: -1;
}

main {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background-image: url(/public/main-bkg.png);
    background-repeat: repeat;
    width: 90%;
    max-width: 700px;
}

h1 {
    color: #007bff;
    font-size: 2.5rem;
}

.tagline {
    color: #00297c;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

#word-input {
    flex-grow: 1;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    font-size: 1.2rem;
}

#word-input:focus {
    outline: none;
    border-color: #007bff;
}

#explain-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#explain-button:hover {
    background-color: #218838;
}

.output {
    background-color: #e9f5ff;
    border-left: 5px solid #007bff;
    padding: 20px;
    border-radius: 10px;
    text-align: left;
    min-height: 50px;
    line-height: 1.6;
    font-size: 1.1rem;
}

.language-selector legend {
    padding: 0 10px;
    font-weight: bold;
    color: #555;
}

.language-selector div {
    display: flex;
    align-items: center;
}

.language-selector label {
    margin-left: 5px;
    cursor: pointer;
}

.language-selector,
.age-selector {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px 25px;
    margin: 20px 0;
    text-align: left;
    flex: 1;
    min-width: 200px;
}

.language-selector legend,
.age-selector legend {
    padding: 0 10px;
    font-weight: bold;
    color: #555;
}


.language-selector div,
.age-selector div {
    display: block;
    margin-bottom: 12px;
}

.language-selector label,
.age-selector label {
    margin-left: 8px;
    cursor: pointer;
}

.language-selector div:last-child,
.age-selector div:last-child {
    margin-bottom: 0;
    /* No space after the last item */
}

#age-slider {
    width: 80%;
    margin-top: 10px;
    cursor: pointer;
}

#age-output {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

#new-definition-button {
    display: block;
    margin: 20px auto 0;
    margin-right:0px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #007bff;
    background-color: #e9f5ff;
    border: 2px solid #007bff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#new-definition-button:hover {
    background-color: #007bff;
    color: white;
}

.google-signin-button {
    display: inline-block;
    background: #4285F4;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    margin-top: 20px;
    transition: background 0.2s;
}

.google-signin-button:hover {
    background: #357ae8;
}

.app-header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 8px 15px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.signout-button {
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    font-weight: bold;
}

.signout-button:hover {
    color: #000;
}

.dashboard-link {
    font-size: 0.9rem;
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

.dashboard-link:hover {
    text-decoration: underline;
}

.dashboard-section {
    border-top: 1px solid #eee;
    margin-top: 30px;
    padding-top: 20px;
}

.status-message {
    margin-top: 10px;
    color: #008f86;
}

/* in public/style.css -> REPLACE old history styles */
.history-container {
    text-align: left;
    margin-top: 20px;
}

.history-item {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    /* Important for the animation */
}

.history-header {
    background-color: #f8f9fa;
    padding: 1px 15px 1px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header:hover {
    background-color: #f1f3f5;
}

.history-header .word-header {
    display: flex;
    align-items: baseline;
    /* Aligns the text nicely */
    gap: 8px;
    /* Adds space between elements */
    flex-wrap: wrap;
    /* Allows it to wrap on small screens */
}

.history-header .word-header .word {
    font-weight: bold;
    font-size: 1rem;
}

.history-header .word-header .meta {
    font-size: 0.8rem;
    color: #6c757d;
}

.history-body {
    padding: 0px 15px 0px 15px;
    border-top: 1px solid #eee;
    line-height: 1.2;
    /* This is the magic for the expand/collapse animation */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

/* This class will be added by JavaScript to expand the item */
.history-item.expanded .history-body {
    max-height: 500px;
    /* Adjust if explanations can be very long */
    padding: 1px 15px 1px 15px;
}

/* Add to the end of public/style.css */

.debug-output {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-top: 20px;
    font-family: monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    /* Allows long lines to wrap */
    word-break: break-all;
    text-align: left;
}


.settings-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    /* Allows stacking on small screens */
    align-items: stretch;
    /* Makes the boxes the same height */
}

/* Make each fieldset take up equal space */
.settings-container .language-selector,
.settings-container .age-selector {
    flex: 1;
    min-width: 200px;
    /* Prevents them from getting too squished */
}


/* --- Mobile Responsiveness --- */
/* These styles will ONLY apply to screens 600px wide or less (i.e., most phones) */
@media (max-width: 600px) {

    /* 1. Fix the main container and remove horizontal scroll */
    main {
        padding: 20px;
        /* Reduce padding on small screens */
        width: 100%;
        /* Allow it to take the full width */
        max-width: none;
        /* Override the desktop max-width */
        box-sizing: border-box;
        /* Ensures padding is included in the width */
        box-shadow: none;
        /* Remove shadow for a flatter mobile look */
        border-radius: 0;
    }

    /* 2. Fix the font sizes for better readability */
    h1 {
        font-size: 1.2rem;
        /* Make the main title a bit smaller */
    }

    #word-input,
    #explain-button {
        font-size: 0.9rem;
        /* Adjust font size for input and button */
        padding: 10px;
    }

    /* 3. Fix the header to be centered and not overflow */
    .app-header {
        position: static;
        /* Remove absolute positioning */
        transform: none;
        width: auto;
        /* Let it size to its content */
        margin: 0 auto 20px;
        /* Center the header and add space below it */
        justify-content: center;
    }

    .user-info span {
        display: none;
        /* Hide the "Welcome, ..." text on very small screens */
    }

    /* 4. Fix the dashboard layout to stack vertically */
    .settings-container {
        flex-direction: column;
        /* Stack settings boxes vertically */
    }
}


/* A reusable, modern button style */
.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-primary:active {
    transform: scale(0.98);
    /* Adds a nice "press" effect */
}

.main-logo {
    max-height: 300px;
    max-width: 300px;
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
}

/* Add to the end of public/style.css */

/* A secondary button style for actions like "Listen" */
.btn-secondary {
    background-color: transparent;
    color: #007bff;
    border: 2px solid #007bff;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 15px;
    /* Add some space above */
}

.btn-secondary:hover {
    background-color: #007bff;
    color: white;
}

/* A simple disabled style */
.btn-secondary:disabled {
    border-color: #adb5bd;
    color: #adb5bd;
    cursor: not-allowed;
}

.btn-loading {
    cursor: wait;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}


.output-actions {
    display: flex;
    justify-content: center;
    /* Center the buttons */
    gap: 10px;
    /* Add space between them */
    margin-top: 15px;
}

.disclaimer{
  font-size: 0.875rem;   /* ~14px */
  line-height: 1.4;
  color: #6b7280;        /* muted gray */
  margin-top: 0.5rem;
}
@media (prefers-color-scheme: dark){
  .disclaimer{ color:#9ca3af; }
}
