:root {
    /* DALMI Color Palette based on A7D707 */
    --primary-color: #A7D707; /* Main brand color - lime green */
    --primary-dark: #86ac06; /* Darker shade for hover states */
    --primary-light: #c4f52a; /* Lighter shade for accents */

    /* Complementary colors */
    --accent-blue: #0779d7; /* Blue for listening state */
    --accent-purple: #7007d7; /* Purple for processing state */
    --secondary-color: #07d7a7; /* Teal for secondary elements */
    --danger-color: #d70751; /* Red for errors/stop actions */
    --warning-color: #d79e07; /* Amber for warnings */

    /* Dark theme colors */
    --dark-bg-primary: #121212; /* Main background */
    --dark-bg-secondary: #1e1e1e; /* Secondary background */
    --dark-bg-tertiary: #2d2d2d; /* Tertiary background */
    --dark-surface: #252525; /* Surface elements */
    --dark-border: #333333; /* Border color */

    /* Grays */
    --gray-100: #e0e0e0;
    --gray-200: #c7c7c7;
    --gray-300: #adadad;
    --gray-400: #8f8f8f;
    --gray-500: #737373;
    --gray-600: #5c5c5c;
    --gray-700: #454545;
    --gray-800: #2e2e2e;
    --gray-900: #1a1a1a;

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-tertiary: #737373;
    --text-brand: #c4f52a;

    /* UI elements */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-circle: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px rgba(167, 215, 7, 0.5);
    --shadow-glow-blue: 0 0 15px rgba(7, 121, 215, 0.5);

    /* Typography */
    --font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Layout */
    --sidebar-width: 300px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--dark-bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Sidebar - hidden by default, shown when settings active */
.sidebar {
    position: absolute;
    top: 0;
    right: -100%;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--dark-bg-secondary);
    border-left: 1px solid var(--dark-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    transition: right var(--transition-normal);
    z-index: 100;
}

.sidebar.active {
    right: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--dark-border);
}

.logo-icon {
    font-size: 24px;
    color: var(--primary-color);
}

.logo-container h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.settings-panel, .conversation-history {
    background-color: var(--dark-bg-tertiary);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--dark-border);
}

.settings-panel h3, .conversation-history h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

/* Settings toggle button */
.settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-circle);
    background-color: var(--dark-surface);
    border: 1px solid var(--dark-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    outline: none;
}

.settings-toggle:hover {
    background-color: var(--dark-bg-tertiary);
    transform: rotate(15deg);
    color: var(--primary-color);
}

.settings-toggle:active {
    transform: scale(0.95) rotate(15deg);
}

.settings-toggle i {
    font-size: 20px;
}

.setting-group {
    margin-bottom: 16px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--gray-700);
}

.voice-select, #language-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    background-color: var(--dark-surface);
    font-size: 14px;
    color: var(--text-primary);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-700);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

/* Central Dot - Main UI Element */
.central-circle-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.central-circle {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-circle);
    background-color: var(--primary-color);
    position: relative;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.central-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--border-radius-circle);
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    z-index: 2;
}

.central-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px 5px rgba(167, 215, 7, 0.6);
}

.central-circle:active {
    transform: scale(0.95);
}

.circle-icon {
    color: rgba(0, 0, 0, 0.5);
    font-size: 32px;
    z-index: 3;
    transition: all var(--transition-normal);
}

.central-circle.listening .circle-icon {
    color: white;
    animation: pulse-icon 1.5s infinite alternate;
}

.central-circle.processing .circle-icon {
    color: white;
    animation: spin-icon 1.5s infinite linear;
}

@keyframes spin-icon {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse-icon {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.central-circle.listening {
    background-color: var(--accent-blue);
    animation: pulse-listening 1.5s infinite alternate;
}

.central-circle.speaking {
    background-color: var(--primary-color);
    animation: pulse-speaking 0.8s infinite alternate;
}

.central-circle.processing {
    background-color: var(--accent-purple);
    animation: pulse-processing 1.2s infinite alternate;
}

@keyframes pulse-listening {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px 2px rgba(7, 121, 215, 0.5);
    }
    100% {
        transform: scale(1.1);
        box-shadow: 0 0 20px 5px rgba(7, 121, 215, 0.7);
    }
}

@keyframes pulse-speaking {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px 2px rgba(167, 215, 7, 0.5);
    }
    100% {
        transform: scale(1.15);
        box-shadow: 0 0 20px 5px rgba(167, 215, 7, 0.7);
    }
}

@keyframes pulse-processing {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px 2px rgba(112, 7, 215, 0.5);
    }
    100% {
        transform: scale(1.1);
        box-shadow: 0 0 20px 5px rgba(112, 7, 215, 0.7);
    }
}

/* Sound Wave Animation */
.sound-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    pointer-events: none;
}

.wave {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    opacity: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.central-circle.listening .wave {
    border-color: var(--accent-blue);
}

.wave-1, .wave-2, .wave-3 {
    animation: wave-animation 3s infinite linear;
}

.wave-1 {
    animation-delay: 0s;
}

.wave-2 {
    animation-delay: 1s;
}

.wave-3 {
    animation-delay: 2s;
}

@keyframes wave-animation {
    0% {
        width: 60px;
        height: 60px;
        opacity: 0.8;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

.circle-status {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.8;
}

.app-description {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-tertiary);
    text-align: center;
    max-width: 300px;
    line-height: 1.4;
}

/* iOS Permission Button */
.ios-permission-btn {
    margin-top: 20px;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.ios-permission-btn:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ios-permission-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.ios-permission-btn i {
    font-size: 18px;
}

#rate-value, #pitch-value {
    font-size: 14px;
    color: var(--gray-700);
    width: 30px;
    text-align: right;
}

#history-list {
    list-style: none;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

#history-list li {
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gray-700);
}

#history-list li:hover {
    background-color: var(--gray-200);
}

#history-list li.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 24px;
    background-color: var(--dark-bg-secondary);
    border-bottom: 1px solid var(--dark-border);
}

.status-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.seo-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.connection-status.connected i {
    color: var(--primary-color);
}

.connection-status.disconnected i {
    color: var(--danger-color);
}

.status {
    font-size: 14px;
    color: var(--text-secondary);
}

.actions {
    display: flex;
    gap: 12px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: var(--dark-bg-primary);
    position: relative;
    z-index: 5;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    padding-top: 150px; /* Space for the central dot */
    padding-bottom: 100px; /* Space at the bottom */
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--border-radius-lg);
    line-height: 1.5;
    position: relative;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(5px);
}

.message pre {
    margin: 12px 0;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    background-color: rgba(0, 0, 0, 0.5);
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
}

.message code {
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--primary-light);
}

.user-message {
    align-self: flex-end;
    background-color: rgba(167, 215, 7, 0.2);
    color: var(--text-primary);
    border: 1px solid rgba(167, 215, 7, 0.3);
    border-bottom-right-radius: 4px;
}

.ai-message {
    align-self: flex-start;
    background-color: rgba(7, 121, 215, 0.2);
    color: var(--text-primary);
    border: 1px solid rgba(7, 121, 215, 0.3);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
    text-align: right;
}

.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
    font-style: italic;
    background-color: white;
    padding: 12px 16px;
}

.thinking .dots {
    display: flex;
    gap: 4px;
}

.thinking .dot {
    width: 8px;
    height: 8px;
    background-color: var(--gray-500);
    border-radius: 50%;
    animation: pulse 1.5s infinite ease-in-out;
}

.thinking .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking .dot:nth-child(3) {
    animation-delay: 0.4s;
}

.audio-visualizer-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
}

.audio-visualizer-container.active {
    display: flex;
    opacity: 0.5;
}

#audio-visualizer {
    width: 100%;
    height: 100%;
    max-width: 100%;
}

/* Input Area */
.input-container {
    padding: 16px 24px;
    background-color: var(--dark-bg-secondary);
    border-top: 1px solid var(--dark-border);
    position: relative;
    z-index: 20;
}

.voice-controls {
    display: none; /* Hide traditional controls - we'll use the central circle */
}

.conversation-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--gray-700);
}

.status-indicator.active {
    background-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(167, 215, 7, 0.2);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(167, 215, 7, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(167, 215, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(167, 215, 7, 0);
    }
}

.text-input {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.text-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--dark-border);
    background-color: var(--dark-surface);
    color: var(--text-primary);
    border-radius: var(--border-radius-lg);
    font-size: 16px;
    resize: none;
    max-height: 120px;
    transition: height var(--transition-normal), border-color var(--transition-fast);
}

.text-input textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.text-input textarea::placeholder {
    color: var(--text-tertiary);
}

/* Buttons */
.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--border-radius-md);
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn.primary {
    background-color: var(--primary-color);
    color: var(--dark-bg-primary);
}

.control-btn.primary:hover {
    background-color: var(--primary-light);
}

.control-btn.secondary {
    background-color: var(--dark-surface);
    color: var(--text-primary);
    border: 1px solid var(--dark-border);
}

.control-btn.secondary:hover {
    background-color: var(--dark-bg-tertiary);
}

.control-btn.danger {
    background-color: var(--danger-color);
    color: white;
}

.control-btn.danger:hover {
    background-color: #f50057;
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-md);
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.secondary-btn:hover {
    background-color: var(--dark-surface);
    color: var(--text-primary);
}

/* Footer */
.app-footer {
    padding: 16px 24px;
    background-color: var(--dark-bg-secondary);
    border-top: 1px solid var(--dark-border);
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        right: -100%;
    }

    .sidebar.active {
        right: 0;
    }

    .central-circle {
        width: 70px;
        height: 70px;
    }

    .circle-icon {
        font-size: 28px;
    }

    .circle-status {
        font-size: 14px;
    }

    .app-description {
        font-size: 12px;
        max-width: 250px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .connection-status, .status {
        font-size: 12px;
    }

    .input-container {
        padding: 12px 16px;
    }

    .app-footer {
        padding: 12px 16px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .central-circle {
        width: 60px;
        height: 60px;
    }

    .circle-icon {
        font-size: 24px;
    }

    .settings-toggle {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }

    .settings-toggle i {
        font-size: 16px;
    }

    .setting-group label {
        font-size: 12px;
    }

    .voice-select, #language-select {
        font-size: 12px;
        padding: 6px 10px;
    }

    .chat-header {
        padding: 8px 12px;
    }

    .status-container {
        gap: 8px;
    }
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
    }

    .chat-main {
        height: 60vh;
    }
}

@media (max-width: 768px) {
    .voice-controls {
        flex-wrap: wrap;
    }

    .control-btn {
        flex: 1;
    }

    .chat-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .message {
        max-width: 90%;
    }
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}