:root {
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #22c55e;
    --dark: #f8fafc;
    --darker: #f1f5f9;
    --card: rgba(255, 255, 255, 0.95);
    --border: rgba(22, 163, 74, 0.2);
    --text: #1e293b;
    --text-muted: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--darker);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

/* Animated Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #f0fdf4 100%);
    overflow: hidden;
}

.bg-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(22, 163, 74, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(34, 197, 94, 0.08) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.chat-header {
    padding: 1.25rem;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(22, 163, 74, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.school-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header h1 i {
    -webkit-text-fill-color: var(--primary);
}

.chat-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.school-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Floating Doc Button */
.floating-doc-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 6px 25px rgba(22, 163, 74, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

.floating-doc-btn:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 10px 35px rgba(22, 163, 74, 0.5);
}

/* Title Link (for mobile doc download) */
.title-link {
    text-decoration: none;
    color: inherit;
    background: inherit;
    -webkit-background-clip: inherit;
    -webkit-text-fill-color: inherit;
    background-clip: inherit;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    color: white;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.message-content {
    background: var(--card);
    backdrop-filter: blur(10px);
    padding: 1rem 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    line-height: 1.6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.message-content li {
    margin-bottom: 0.25rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Welcome Message */
.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.suggestion-chip {
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.suggestion-chip:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

/* Chat Input */
.chat-input-container {
    padding: 1rem;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-top: 1rem;
    box-shadow: 0 -4px 20px rgba(22, 163, 74, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-button {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(22, 163, 74, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        padding: 0.75rem;
    }

    .chat-header {
        padding: 1rem;
        border-radius: 16px;
    }

    .header-content {
        gap: 1rem;
    }

    .school-logo {
        width: 55px;
        height: 55px;
    }

    .chat-header h1 {
        font-size: 1.25rem;
    }

    .chat-header p {
        font-size: 0.8rem;
    }

    .school-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.7rem;
    }

    .message {
        max-width: 92%;
    }

    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .message-content {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }

    .suggestion-chip {
        font-size: 0.8rem;
        padding: 0.4rem 0.85rem;
    }

    .chat-input {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }

    .send-button {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: 0.5rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .school-logo {
        width: 60px;
        height: 60px;
    }

    .chat-header h1 {
        justify-content: center;
    }

    .welcome-suggestions {
        justify-content: center;
    }

    .floating-doc-btn {
        display: none;
    }

    .title-link {
        text-decoration: underline;
        text-decoration-style: dotted;
        text-underline-offset: 4px;
    }
}