:root {
    /* Color Variables */
    --font-family-primary: "Arial", sans-serif;
    --color-background: #002B36;
    --color-box-background: #375767;
    --color-primary: #64a494;
    --color-primary-dark: #6c8d80;
    --color-secondary: #1B5767;
    --color-accent: #00ffaf;
    --color-yellow: #BB9D1C;
    --color-current-section-green: #90ee90;
    --color-light: #f5f5f5;
    --color-lighter: #e0e0e0;
    --color-text: white;
    --color-tab-bg: #efefef;
    --color-icon-info-hover: #0056b3;
    --color-shadow: rgba(0, 0, 0, 0.1);
    --color-white: #fff;
    --color-modal-header: #88a396;

    /* Dimension Variables */
    --border-radius-large: 30px;
    --border-radius-small: 5px;
    --box-shadow-default: 0 4px 6px var(--color-shadow);
    --box-shadow-light: 0 2px 4px var(--color-shadow);
    --padding-default: 15px;
    --padding-large: 30px;
    --padding-small: 8px 16px;
    --margin-default: 15px;
    --transition-duration: 0.3s;
    --font-size-default: 14px;
    --font-size-large: 1rem;
    --font-size-icon: 24px;
}

body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--color-background);
    color: var(--color-text);
}

.top-bar {
    height: 45px;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.top-bar a {
    text-decoration: none;
    color: white;
    opacity: 0.8;
    font-size: 18px;
}

.logo {
    height: 25px;
    margin-bottom: 10px;
}

#chatbox {
    max-height: 300px;
    height: 40vh;
    border: 1px solid var(--color-secondary);
    overflow-y: scroll;
    padding: 15px;
    margin-bottom: 20px;
    background-color: var(--color-box-background);
    border-radius: 5px;
    position: relative;
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9524) 95%, transparent);
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9524) 95%, transparent);
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

/* Recording countdown styles */
#recording-countdown {
    position: relative;
    top: -0;
    left: 0;
    color: white;
    font-size: 12px;
    display: none;
}

/* Countdown clock styles */
.countdown-clock {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    border: 2px solid white;
    position: relative;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
    font-size: 18px;
    color: #999;
    font-weight: bold;
}

/* Add positioning for the text inside the clock */
.countdown-clock::after {
    content: attr(data-seconds);
    position: absolute;
    top: 7px;
    left: 7px;
}

.countdown-clock::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 50%;
    background-color: transparent;
    transform-origin: 0 0;
    transform: rotate(0deg);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.countdown-clock.running {
    background-image: conic-gradient(
        var(--countdown-color, white) var(--countdown-progress, 0%),
        transparent var(--countdown-progress, 0%)
    );
}

/* Flashing animation for last 10 seconds */
@keyframes redPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.countdown-clock.warning {
    animation: redPulse 1s infinite;
    --countdown-color: #ff3333;
}

#record-btn {
    order: 1;
    background-color: var(--color-accent);
    position: relative;
    padding: 8px 26px 8px 16px;
    border: none;
    border-radius: 4px;
    overflow: hidden;
}

#record-btn i {
    color: black;
    position: relative;
    z-index: 1;
}

#record-btn.recording {
    background-color: var(--color-accent);
    padding: 8px 26px 8px 16px;
    border: none;
    position: relative;
}

#record-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(244, 241, 241, 0.9);
}

#user-input {
    order: 3;
    flex-grow: 1;
    padding: 10px;
    resize: none;
    overflow: hidden;
    height: 60px;
    min-height: 60px !important;
    font-family: Arial, sans-serif;
    font-size: 16px;
    background-color: var(--color-box-background);
    border: 1px solid var(--color-secondary);
    color: white;
    border-radius: 4px;
    line-height: 20px;
    box-sizing: border-box;
}

#send-btn {
    order: 4;
    background-color: var(--color-accent);
    color: black;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(244, 241, 241, 0.9);
}

#send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Loading indicators */
.loading-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    gap: 10px;
    margin: 0;
    background-color: rgba(55, 87, 103, 0.9); /* Semi-transparent background */
    border-radius: 5px;
    width: fit-content;
    min-width: 200px;
    position: absolute;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-secondary);
    border-top: 3px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--color-text);
    font-size: 1.5em;
    margin: 0;
    width: 100%;
    height: 100%;
    padding: 0;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Progress bar */
#progress-bar-container {
    width: 100%;
    background-color: var(--color-secondary);
    height: 5px;
    margin-top: 10px;
    border-radius: 2px;
    overflow: hidden;
}

#progress-bar {
    width: 0;
    height: 100%;
    background-color: var(--color-primary);
    transition: width 0.3s ease-in-out;
    box-shadow: 0 0 5px rgba(78, 205, 196, 0.7);
}

/* Button styles */
button {
    font-size: larger;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer
}

.preserve-whitespace {
    white-space: pre-wrap;
}

/* Translation loader */
#translation-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--color-box-background);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 1000;
}

#translation-loader i {
    color: var(--color-accent);
    margin-bottom: 10px;
}

#translation-loader span {
    display: block;
    color: white;
}

/* Link styles */
a:-webkit-any-link {
    color: unset;
}

/* Restart button */
#restart-btn {
    padding: 5px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    position: fixed;
    top: 20px;
    right: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restart-btn:hover {
    background-color: var(--color-accent);
}

#restart-btn i {
    font-size: 10px;
    vertical-align: middle;
}

/* Notification container */
.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 909060;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--color-background);
    padding-top: 10vh;
}

.modal-content {
    background-color: var(--color-box-background);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--color-secondary);
    width: 80vw;
    min-width: 300px;
    max-width: 1000px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalFadeIn 0.4s ease-out;
}

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

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 5px 5px 0 0;
}

.modal-header .modal-title {
    display: flex;
    align-items: center;
    color: var(--color-accent);
    font-size: 18px;
    margin: 0;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) rgba(0, 0, 0, 0.2);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--color-primary);
    border-radius: 4px;
}

/* Modal section styling */
.modal-section {
    position: relative;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: var(--border-radius-small);
    background-color: rgba(0, 0, 0, 0.15);
    transition: all var(--transition-duration);
    border-left: 3px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: sectionFadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

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

.section-icon {
    font-size: 22px;
    vertical-align: top;
    width: 28px;
    height: 28px;
    text-align: center;
    border-radius: 50%;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, color 0.3s;
    float: left;
    margin-right: 15px;
}

.modal-section p {
    overflow: hidden;
    margin: 0;
    line-height: 1.5;
}

.modal-section::after {
    content: "";
    display: table;
    clear: both;
}

/* Style each section with unique colors */
.modal-section:nth-child(1) {
    border-left-color: var(--color-accent);
    animation-delay: 0.1s;
}
.modal-section:nth-child(1) .section-icon {
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(0, 255, 175, 0.3);
}

.modal-section:nth-child(2) {
    border-left-color: var(--color-yellow);
    animation-delay: 0.2s;
}
.modal-section:nth-child(2) .section-icon {
    color: var(--color-yellow);
    text-shadow: 0 0 10px rgba(187, 157, 28, 0.3);
}

.modal-section:nth-child(3) {
    border-left-color: var(--color-primary);
    animation-delay: 0.3s;
}
.modal-section:nth-child(3) .section-icon {
    color: var(--color-primary);
    text-shadow: 0 0 10px rgba(100, 164, 148, 0.3);
}

.audio-section {
    border-left-color: #ff7e5f;
}
.audio-section .section-icon {
    color: #ff7e5f;
    text-shadow: 0 0 10px rgba(255, 126, 95, 0.3);
}

/* Footer styles */
.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.15);
}

.modal-footer button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s;
    border: none;
    font-size: 14px;
}

.modal-footer button i {
    margin-right: 8px;
    font-size: 14px;
}

.modal-footer .btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.modal-footer .btn-primary:hover {
    background-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Start interview button styling */
#start-interview-btn {
    padding: 12px 28px;
    font-size: 22px;
    width: 100%;
    transition: all 0.3s;
    background-color: var(--color-primary);
    border: none;
    color: white;
    border-radius: 6px;
    box-shadow: 0 0 10px var(--color-primary);
    position: relative;
    overflow: hidden;
    animation: glow 2s infinite ease-in-out;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px var(--color-primary);
    }
    50% {
        box-shadow: 0 0 20px var(--color-accent);
    }
}

#start-interview-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

#start-interview-btn:hover::before {
    left: 100%;
}

#start-interview-btn:hover {
    background-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

#start-interview-btn i {
    margin-right: 10px;
    font-size: 18px;
    transition: transform 0.3s;
}

#start-interview-btn:hover i {
    transform: scale(1.2) rotate(10deg);
}

/* Authentication styles */
.auth-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.auth-button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.auth-button:hover {
    background-color: var(--color-accent);
}

#firebaseui-auth-container {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--color-box-background);
    border: 1px solid var(--color-secondary);
    border-radius: 4px;
    padding: 10px;
    margin-top: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Anonymous section styling */
#anonymous-section[data-anonymous="false"] {
    display: none !important;
}

#anonymous-section[data-anonymous="true"] {
    display: block;
    animation: fadeInSection 0.5s ease-out;
}

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

/* Mobile responsiveness */
@media (max-width: 768px) {
    #record-btn {
        display: block !important;
        padding: 8px 16px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .input-container {
        flex-wrap: wrap;
    }
}

/* + Sectioned Progress Bar Styles */
.sectioned-progress-bar-container {
    display: flex;
    width: 100%;
    height: 15px; /* Make it thicker than the line bar */
    margin-top: 10px;
    border-radius: 5px;
    overflow: hidden;
    border: 1.5px solid #efefef95;
    background-color: var(--color-secondary); /* Background for the container */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Inner shadow for depth */
}

.section-block {
    height: 100%;
    background-color: var(--color-box-background); /* Default: inactive section color */
    border-right: 1px solid rgba(255, 255, 255, 0.6); /* Brighter border (increased opacity) */
    transition: background-color 0.5s ease-in-out; /* Smooth transition */
    box-sizing: border-box; /* Include border in width calculation */
}

.section-block:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.6); /* Add left border to first block (increased opacity) */
}

.section-block:last-child {
    /* border-right: none; /* No border for the last block */ 
    /* Keep right border for consistency */
}

.section-block.current {
    /* background-color: var(--color-yellow); /* Highlight color for current section */
    /* box-shadow: inset 0 0 5px rgba(255, 255, 100, 0.5); /* Glow effect */ 
    /* The background is now set dynamically by JavaScript */
}

.section-block.completed {
    background-color: var(--color-current-section-green); /* Color for completed sections */
    background-image: none; /* Ensure no gradient remains */
    box-shadow: none; /* Remove glow */
}

/* Chat loading overlay positioned in the middle of the chatbox */
#chat-loading {
    top: 150px; /* Position at approximately the middle of chatbox */
    left: 50%;
    transform: translateX(-50%);
}

/* Transcription loading overlay positioned in the middle of the chatbox */
#transcription-progress {
    top: 150px; /* Position at approximately the middle of chatbox */
    left: 50%;
    transform: translateX(-50%);
}

/* Position parent container properly */
#interview-container {
    position: relative; /* Make this a positioning context */
}

/* Hide control texts like LANG=xx, %%%, $$$ in displayed chat but keep them in DOM */
.control-text {
    display: none !important;
}