:root {
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.1);
    --text-primary: #1c1c1e;
    --text-secondary: #6b7280;
    --accent-color: #007aff;
    --action-bg: rgba(230, 230, 230, 0.7);
    --action-bg-hover: rgba(210, 210, 210, 0.9);
    --chat-bg: #ffffff;
    --user-msg-bg: #007aff;
    --user-msg-text: #ffffff;
    --bot-msg-bg: #e5e5ea;
    --bot-msg-text: #1c1c1e;
    --input-bg: #e5e5ea;
    --quick-option-bg: rgba(0, 122, 255, 0.1);
    --quick-option-text: #007aff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.dark-mode {
    --bg-color: #1c1c1e;
    --card-bg: rgba(44, 44, 46, 0.7);
    --card-border: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent-color: #0a84ff;
    --action-bg: rgba(58, 58, 60, 0.7);
    --action-bg-hover: rgba(72, 72, 74, 0.9);
    --chat-bg: #000000;
    --user-msg-bg: #0a84ff;
    --user-msg-text: #ffffff;
    --bot-msg-bg: #2c2c2e;
    --bot-msg-text: #ffffff;
    --input-bg: #2c2c2e;
    --quick-option-bg: rgba(10, 132, 255, 0.2);
    --quick-option-text: #0a84ff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease;
}

.main-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: 28px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* --- Controls --- */
.card-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    background: var(--action-bg);
    padding: 6px;
    border-radius: 16px;
    z-index: 10;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    color: var(--text-primary);
    background: var(--action-bg-hover);
}

/* --- Contact Card Part --- */
.contact-card {
    padding: 24px;
    padding-top: 60px; /* Space for controls */
    border-bottom: 1px solid var(--card-border);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
}

.identity h1 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
}

.identity p {
    font-size: 0.95em;
    color: var(--text-secondary);
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.card-actions a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.75em;
    font-weight: 500;
}

.card-actions a .icon-wrapper {
    width: 54px;
    height: 54px;
    background: var(--action-bg);
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4em;
    color: var(--accent-color);
    transition: all 0.2s ease;
}

.card-actions a:hover .icon-wrapper {
    background: var(--action-bg-hover);
    transform: scale(1.05);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-links a {
    font-size: 1.5em;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: var(--text-primary);
}

/* --- Chat Module Part --- */
.chat-module {
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    height: 350px;
    max-height: 50vh;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    max-width: 85%;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
}

.message.bot {
    align-self: flex-start;
}

.message-content {
    padding: 10px 16px;
    border-radius: 20px;
    line-height: 1.5;
    font-size: 0.95em;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 5px;
}

.message.bot .message-content {
    background: var(--bot-msg-bg);
    color: var(--bot-msg-text);
    border-bottom-left-radius: 5px;
}

.message-content a {
    color: var(--accent-color);
    font-weight: 500;
}

.message-content .quick-option {
    color: var(--accent-color);
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.typing-indicator {
    padding: 10px 16px;
    display: none;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

.chat-input-area {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#userInput {
    flex-grow: 1;
    border: none;
    background: var(--input-bg);
    border-radius: 18px;
    padding: 12px 16px;
    font-size: 0.95em;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-family);
}

#userInput::placeholder {
    color: var(--text-secondary);
}

#sendButton {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1em;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

#sendButton:hover {
    transform: scale(1.1);
}

#quick-options-container {
    padding: 0 16px 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-option {
    background: var(--quick-option-bg);
    color: var(--quick-option-text);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-option:hover {
    transform: translateY(-1px);
}