/* Base Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Layout Components */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

/* Sidebar Styles */
.sidebar {
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.sidebar h2 {
    font-size: 18px;
    margin-top: 0;
}

.sidebar p {
    margin: 10px 0;
}

#session-data {
    flex-grow: 1;
    margin-top: 20px;
    padding-left: 10px;
}

#session-data div {
    margin-bottom: 10px;
}

#session-data a {
    color: blue;
}

#session-data a:hover {
    color: #007bff;
}

#session-data + button {
    margin-top: 20px;
}

/* Sidebar Buttons */
.sidebar button {
    display: block;
    width: calc(100% - 40px);
    padding: 10px;
    margin: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease;
    font-size: 16px;
}

#saveFileButton {
    background-color: #4CAF50;
    color: white;
}

#saveFileButton:hover {
    background-color: #45a049;
}

#feedbackButton {
    background-color: transparent;
    color: #007bff;
    text-decoration: underline;
}

#feedbackButton:hover {
    color: #0056b3;
}

.clear-data-button {
    background-color: #f44336;
    color: white;
}

.clear-data-button:hover {
    background-color: #d32f2f;
}

.clear-data-button-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1000;
}

/* Chat Box Styles */
.chat-box {
    flex: 1;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
    overflow-y: auto;
    display: flow-root;
    position: relative;
}

.chat-box::after {
    content: '';
    display: table;
    clear: both;
}

.user-message,
.bot-message {
    margin: 10px 0;
    padding: 15px;
    border-radius: 15px;
    max-width: 90%;
    position: relative;
    clear: both;
}

.user-message {
    background-color: #e1ffc7;
    float: left;
    margin-right: 10%;
    border-bottom-left-radius: 2px;
}

.bot-message {
    background-color: #f1f1f1;
    float: right;
    margin-left: 10%;
    border-bottom-right-radius: 2px;
}

.chat-placeholder {
    background-color: #e0f7fa;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 20px;
    border: 1px solid #32b6f4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chat-placeholder:hover {
    background-color: #b2ebf2;
    border-color: #4fc3f7;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.chat-placeholder:focus {
    outline: none;
}

/* Chat Input */
.chat-input {
    display: flex;
    align-items: flex-start;
}

.chat-input textarea {
    font-family: Arial, sans-serif;
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    resize: none;
    overflow: hidden;
    min-height: 20px;
    max-height: 150px;
    line-height: 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
    transition: background-color 0.5s ease;
}

.chat-input textarea:focus {
    animation: color-change 5s infinite;
}

.chat-input button {
    padding: 10px 20px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    align-self: flex-start;
}

.chat-input button:hover {
    background-color: #0056b3;
}

.send-button-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* File Upload Styles */
.file-upload-label {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 20px;
}

.file-upload-label:hover {
    background-color: #0056b3;
}

.file-upload-input {
    display: none;
}

#fileUploadDiv {
    padding-left: 10px;
}

#uploadedFiles {
    padding-left: 0;  /* Remove default padding */
    margin-left: 0;   /* Remove default margin */
}

.file-upload-list-item {
    list-style: none;
    font-size: smaller;
    padding-left: 4;  /* Remove default padding */
    margin-left: 0;   /* Remove default margin */
}

.file-upload-list-item::before {
    content: '📄';
    margin-right: 4px;
}

.file-link {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

.file-link:hover {
    color: #0056b3;
    text-decoration: none;
}

/* Profile and Login Styles */
.profile-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ddd;
    background-size: 240%;
    background-position: center;
    cursor: pointer;
}

.login-form-container {
    min-width: 320px;
    max-width: 800px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3), 0 0 30px rgba(0,0,0,0.2);
    display: none;
    position: absolute;
    top: 60px;
    right: 60px;
    z-index: 1000;
}

.login-form-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.button-group {
    display: flex;
    align-items: flex-end;
}

#loginButton {
    white-space: nowrap;
    padding: 8px 20px;
    height: 35px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#loginButton:hover {
    background-color: #0056b3;
}

.new-user-container {
    text-align: center;
    margin-top: 25px;
}

.new-user-container a {
    color: #007BFF;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.new-user-container a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.login-error-container {
    margin-bottom: 15px;
}

.close-login-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
}

.close-login-button:hover {
    color: black;
}

#logoutButton {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    font-size: 1.1em;
    font-weight: normal;
}

#logoutButton:hover {
    background-color: #0056b3;
}

/* Password Styles */
.password-container {
    position: relative;
    display: flex;
    align-items: center;
    height: 35px;
}

.toggle-password {
    position: absolute;
    right: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    height: 35px;
    width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.toggle-password:hover {
    background: transparent;
}

.password-container input[type="password"],
.password-container input[type="text"] {
    padding-right: 35px;
    width: 100%;
    height: 35px;
    box-sizing: border-box;
    margin: 0;
}

.password-strength {
    height: 5px;
    width: 0;
    background-color: red;
    transition: width 0.3s ease-in-out;
    margin-top: 5px;
}

/* Registration Section */
#registrationSection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#registrationSection label {
    margin-bottom: 5px;
    font-weight: bold;
    display: block;
}

#registrationSection input[type="email"] {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

#registrationSection .password-container {
    margin-bottom: 10px;
}

#registrationSection input[type="checkbox"] {
    margin-right: 5px;
    margin-bottom: 5px;
    width: auto;
}

#registrationSection div {
    display: flex;
    align-items: center;
}

#registrationSection .g-recaptcha {
    margin-bottom: 10px;
}

#registrationSection button {
    padding: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#registrationSection button:hover {
    background-color: #0056b3;
}

#registrationSection .toggle-password {
    background: transparent;
}

#registrationSection .toggle-password:hover {
    background: transparent !important;
}

#registrationSection .error-message {
    color: red;
    font-weight: bold;
    font-size: 1.2em;
    padding: 5px 10px;
}

#registerSubmitButton:disabled {
    background-color: gray;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Federated Login Buttons */
.federated_buttons {
    text-align: center;
    margin: 1rem 0;
}

.federated_buttons img {
    cursor: pointer;
    width: 250px;
    height: auto;
    transition: transform 0.2s ease;
}

.federated_buttons img:hover {
    transform: scale(1.05);
}

.login-divider {
    text-align: center;
    margin: 1.25rem 0;
    color: #666;
}

/* Notifications and Messages */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.success-message {
    color: green;
    font-weight: bold;
    margin-top: 10px;
    font-size: 1.2em;
}

.error-message {
    color: #f44336;
    margin: 5px 0;
    font-size: 14px;
    font-weight: bold;
}

/* Navigation and Menu Styles */
.nav-reveal {
    position: relative;
    z-index: 1000;
}

.nav-hover-area {
    position: absolute;
    top: -500px;
    left: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 3px;
}

.nav-reveal:hover .nav-hover-area {
    top: 0;
    opacity: 1;
    visibility: visible;
}

.top-nav {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px;
    min-width: 200px;
}

.top-nav ul {
    margin: 0;
    padding: 0;
}

.top-nav li {
    list-style: none;
    margin: 8px 0;
}

.top-nav a {
    display: block;
    padding: 8px 16px;
    text-decoration: underline;
    color: #007BFF;
    transition: all 0.3s ease;
}

.top-nav a:hover {
    color: #004a99;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 4px;
}

.hamburger-icon {
    display: none;
    font-size: 28px;
    padding: 8px 16px 8px 8px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.modal-links {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
}

.modal-links a {
    color: #007bff;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
}

.modal-links a:hover {
    text-decoration: underline;
}

.modal-links .delete-link {
    color: #dc3545;
}

.modal-links .delete-link:hover {
    color: #c82333;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Feedback Form */
#feedbackForm {
    display: flex;
    flex-direction: column;
}

#feedbackForm label {
    margin-bottom: 5px;
    font-weight: bold;
}

#feedbackForm select,
#feedbackForm textarea {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#feedbackForm button {
    padding: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#feedbackForm button:hover {
    background-color: #0056b3;
}

/* Advice Banner */
.advice-banner {
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 15px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: slideIn 0.3s ease-out;
    width: 100%;
    box-sizing: border-box;
    float: left;
    clear: both;
}

.advice-banner p {
    margin: 0 0 10px 0;
    color: #1976d2;
    width: 100%;
}

.advice-banner ul {
    width: 100%;
    max-width: 600px;
    margin: 10px auto;
    padding-left: 20px;
}

.advice-banner li {
    margin-bottom: 8px;
    text-align: left;
}

.advice-banner .button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 10px 0;
    width: 100%;
}

.advice-banner button {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    white-space: nowrap;
}

.advice-banner button:hover {
    background-color: #1565c0;
}

.close-banner {
    color: #666;
    cursor: pointer;
    font-size: 20px;
    padding: 0 5px;
}

.close-banner:hover {
    color: #333;
}

/* Form Options */
.form-options {
    padding: 10px 0 !important;
    margin-top: 10px !important;
    margin-bottom: 10px !important;
    border-top: 1px solid #e0e0e0 !important;
}

.form-options > label {
    padding: 5px 0 !important;
    font-weight: bold;
    display: block !important;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
    vertical-align: middle;
}

.radio-group label {
    font-weight: normal;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.radio-group input[type="radio"]:checked + label,
.radio-group label:has(input[type="radio"]:checked) {  /* for browsers that support :has */
    background-color: #e3f2fd;  /* light blue background */
    color: #0056b3;  /* darker blue text */
    font-weight: bold;
}

/* Loading Indicators */
.loading-indicator,
.chat-loading-indicator,
.login-loading-indicator {
    animation: fadeInOut 2s infinite;
}

.loading-indicator {
    font-size: 1.2em;
    color: #007BFF;
    text-align: center;
    position: sticky;
    bottom: 10px;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: 10px;
    background-color: white;
    z-index: 1;
    opacity: 0;
}

.chat-loading-indicator {
    display: none;
    color: #007BFF;
}

.login-loading-indicator {
    display: none;
    padding-left: 5px;
}

.clock-icon {
    animation: fadeInOut 2s infinite;
    padding-left: 5px;
}

.check-icon {
    color: green;
    padding-left: 5px;
}

/* Animations */
@keyframes fadeInOut {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

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

@keyframes color-change {
    0% { background-color: #e0ffe0; }
    25% { background-color: #b0fcc3; }
    50% { background-color: #9afae4; }
    75% { background-color: #b0fcc3; }
    100% { background-color: #e0ffe0; }
}

.fade-out {
    animation: fadeOut 1s forwards;
}

/* Responsive Styles */
@media only screen and (max-width: 48rem) { /* 768px / 16px = 48rem */
    /* Base responsive styles */
    body {
        font-size: 1.2rem;
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.7rem;
    }

    /* Navigation */
    .nav-hover-area {
        display: none;
    }

    .sidebar.open .nav-hover-area {
        display: block;
        position: static;
        opacity: 1;
        visibility: visible;
        padding-top: 0;
    }

    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: -94%;
        width: 98%;
        height: 100%;
        transition: left 0.3s;
        background-color: rgba(255, 255, 255, 1);
        z-index: 999;
    }

    .sidebar.open {
        left: 0;
    }

    /* Hamburger menu */
    .hamburger-icon {
        display: block;
        position: fixed;
        top: 2%;
        left: 10px;
        cursor: pointer;
        z-index: 1000;
        transition: left 0.3s;
    }

    .sidebar.open .hamburger-icon {
        left: calc(98% - 50px);
    }

    /* Mobile navigation */
    .nav-reveal {
        position: relative;
    }

    .nav-reveal .nav-hover-area {
        display: none !important;
    }

    .sidebar.open .nav-reveal:hover .nav-hover-area {
        display: block !important;
        animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: absolute;
        top: 0;
        left: -20px;
        width: 98vw;
        z-index: 1001;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        padding: 10px;
    }

    .top-nav {
        box-shadow: none;
        background: transparent;
        padding: 0;
    }
    
    .top-nav li {
        margin: 4px 0;
    }

    /* Form layout */
    .login-form-group {
        flex-direction: column;
        gap: 0.625rem;
    }

    .button-group {
        width: 100%;
    }

    #loginButton {
        width: 100%;
    }

    .input-group {
        margin-bottom: 0.625rem;
    }

    /* Advice banner */
    .advice-banner {
        padding: 0.625rem;
    }

    .advice-banner p {
        font-size: 0.9rem;
    }

    .advice-banner .button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .advice-banner button {
        width: 100%;
        max-width: none;
        margin: 0.3125rem 0;
    }

    .advice-banner ul {
        padding-left: 0.9375rem;
    }

    .advice-banner li {
        font-size: 0.9rem;
    }
}

@media (max-width: 30rem) { /* 480px / 16px = 30rem */
    .advice-banner {
        padding: 0.5rem;
    }

    .advice-banner p {
        font-size: 0.85rem;
    }

    .advice-banner button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Add these media queries for form-options */
@media only screen and (max-width: 48rem) { /* 768px */
    .form-options {
        font-size: 0.8rem; /* Reduce overall font size */
    }

    .form-options .radio-group {
        font-size: 0.75rem;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .form-options label {
        font-size: 0.75rem;
        line-height: 1.2;
    }

    .form-options input[type="radio"] {
        transform: scale(0.8); /* Make radio buttons slightly smaller */
        margin: 0 2px;
    }
}

@media only screen and (max-width: 30rem) { /* 480px */
    .form-options {
        font-size: 0.7rem;
    }

    .form-options .radio-group {
        font-size: 0.65rem;
    }

    .form-options label {
        font-size: 0.65rem;
    }
}

textarea#userInput {
    font-size: 16px; /* Prevents iOS zoom */
    padding: 8px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: none;
    overflow-y: hidden;
}

@media only screen and (max-width: 48rem) {
    textarea#userInput {
        font-size: 16px; /* Maintain 16px even on mobile */
    }
}
