/* ===== VARIABLES ===== */
:root {
    --red: #ED1C24;
    --red-dark: #c41820;
    --red-glow: rgba(237, 28, 36, 0.15);
    --black: #1a1a1a;
    --grey-900: #2a2a2a;
    --grey-800: #333;
    --grey-600: #666;
    --grey-400: #999;
    --grey-200: #e5e5e5;
    --grey-100: #f5f5f5;
    --grey-50: #fafafa;
    --white: #ffffff;
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== RESET ===== */
*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

html, body {
    height: 100%;
}

body { 
    font-family: var(--font-body);
    background: linear-gradient(145deg, #e8e8e8 0%, #d4d4d4 100%);
    color: var(--grey-800);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 440px) {
    body { 
        padding: 0; 
        background: var(--white);
    }
}

/* ===== PHONE CONTAINER ===== */
.phone {
    width: 100%;
    max-width: 400px;
    height: 780px;
    background: var(--white);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 
        var(--shadow-xl),
        0 0 0 1px rgba(0,0,0,0.05),
        inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
}

@media (max-width: 440px) {
    .phone {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ===== PIN SCREEN ===== */
.pin-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.4s var(--ease-out), visibility 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.pin-screen.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.02);
}

.pin-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 32px;
    animation: float 3s ease-in-out infinite;
}

.pin-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pin-title {
    font-family: var(--font-display);
    font-size: 24px;
    letter-spacing: 3px;
    color: var(--grey-400);
    margin-bottom: 28px;
    text-transform: uppercase;
}

.pin-dots {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    border: 2px solid var(--grey-200);
    background: transparent;
    transition: all 0.2s var(--ease-bounce);
}

.pin-dot.filled {
    background: var(--red);
    border-color: var(--red);
    transform: scale(1.1);
    box-shadow: 0 0 12px var(--red-glow);
}

.pin-dot.error {
    border-color: var(--red);
    animation: shake 0.5s var(--ease-out);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.pin-key {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--grey-50);
    font-family: var(--font-body);
    font-size: 26px;
    font-weight: 500;
    color: var(--grey-800);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
    background: var(--grey-100);
}

.pin-key:active {
    transform: scale(0.92);
    background: var(--red);
    color: var(--white);
}

.pin-key.empty {
    background: transparent;
    cursor: default;
}

.pin-key.empty:hover {
    background: transparent;
}

.pin-key.delete {
    font-size: 22px;
    color: var(--grey-400);
}

.pin-key.delete:active {
    background: var(--grey-200);
    color: var(--grey-600);
}

.pin-error-msg {
    font-size: 14px;
    font-weight: 500;
    color: var(--red);
    margin-top: 24px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s var(--ease-out);
}

.pin-error-msg.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--grey-100);
    position: relative;
    z-index: 100;
    background: var(--white);
}

.header-logo {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none;
}

.header-logo:hover {
    opacity: 0.7;
}

.header-logo-img {
    height: 32px;
    width: auto;
}

/* ===== HAMBURGER ===== */
.hamburger {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.hamburger:hover {
    background: var(--grey-50);
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--grey-800);
    border-radius: 1px;
    transition: all 0.3s var(--ease-out);
    transform-origin: center;
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== DROPDOWN ===== */
.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px) scale(0.96);
    transform-origin: top right;
    transition: all 0.25s var(--ease-out);
    min-width: 200px;
    overflow: hidden;
    z-index: 99;
}

.dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 500;
    color: var(--grey-800);
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--grey-50);
    -webkit-tap-highlight-color: transparent;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--grey-50);
}

.dropdown-item:active {
    background: var(--grey-100);
}

.dropdown-item .chevron {
    color: var(--red);
    margin-right: 10px;
    font-weight: 700;
    font-size: 18px;
    transition: transform 0.2s var(--ease-out);
}

.dropdown-item:hover .chevron {
    transform: translateX(3px);
}

.dropdown-item.muted {
    color: var(--grey-400);
}

.dropdown-item.muted .chevron {
    color: var(--grey-300);
}

/* ===== OVERLAY ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-out);
    z-index: 50;
}

.overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ===== HOME CONTENT ===== */
.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    gap: 28px;
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.home-content.hidden {
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
    position: absolute;
}

/* ===== HELLO BUBBLE ===== */
.hello-container {
    margin-bottom: 24px;
    width: 100%;
    max-width: 320px;
    display: flex;
    justify-content: center;
}

.hello-img {
    width: 80%;
    height: auto;
    object-fit: contain;
    animation: helloAppear 0.6s var(--ease-bounce);
}

/* ===== INPUT AREA ===== */
.home-input-area {
    width: 100%;
    max-width: 320px;
    position: relative;
    display: flex;
    align-items: center;
}

.home-input {
    width: 100%;
    padding: 16px 56px 16px 20px;
    border: 2px solid var(--grey-200);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s var(--ease-out);
    background: var(--white);
}

.home-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px var(--red-glow);
}

.home-input::placeholder {
    color: var(--grey-400);
    font-weight: 400;
}

.input-send {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--red);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
    color: var(--white);
}

.input-send:hover {
    background: var(--red-dark);
    transform: translateY(-50%) scale(1.05);
}

.input-send:active {
    transform: translateY(-50%) scale(0.95);
}

.input-send .send-icon {
    width: 18px;
    height: 18px;
    transform: rotate(45deg);
}

/* ===== EXAMPLE PROMPTS ===== */
.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 340px;
}

.example-btn {
    padding: 10px 18px;
    background: var(--grey-50);
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--grey-600);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.example-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--white);
}

.example-btn:active {
    transform: scale(0.96);
}

/* ===== HOME FOOTER ===== */
.home-footer {
    margin-top: auto;
    padding: 18px 22px;
    border-top: 1px solid var(--grey-100);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-logo {
    height: 28px;
    width: auto;
}

/* ===== CONVERSATION VIEW ===== */
.conversation-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    bottom: 0;
    transition: opacity 0.4s var(--ease-out);
    overflow: hidden;
}

.conversation-view.visible {
    opacity: 1;
    visibility: visible;
    position: relative;
    top: 0;
}

.conversation-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0; /* Key fix for flex scroll */
}

.conversation-area::-webkit-scrollbar {
    width: 6px;
}

.conversation-area::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-area::-webkit-scrollbar-thumb {
    background: var(--grey-200);
    border-radius: 3px;
}

.conversation-area::-webkit-scrollbar-thumb:hover {
    background: var(--grey-400);
}

/* ===== MESSAGES ===== */
.user-message {
    align-self: flex-end;
    background: var(--red);
    color: var(--white);
    padding: 14px 20px;
    border-radius: 24px 24px 6px 24px;
    max-width: 85%;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(237, 28, 36, 0.2);
}

.dot-response {
    align-self: flex-start;
    max-width: 95%;
}

.dot-text {
    font-size: 15px;
    color: var(--grey-800);
    margin-bottom: 14px;
    line-height: 1.6;
}

/* ===== THINKING DOTS ===== */
.thinking-dots {
    display: flex;
    gap: 8px;
    padding: 20px 0;
}

.thinking-dot {
    width: 12px;
    height: 12px;
    background: var(--red);
    border-radius: var(--radius-full);
    animation: bounce 1.4s infinite ease-in-out;
    box-shadow: 0 2px 8px rgba(237, 28, 36, 0.3);
}

.thinking-dot:nth-child(1) { animation-delay: 0s; }
.thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot:nth-child(3) { animation-delay: 0.3s; }

/* ===== CLIENT CARDS ===== */
.client-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.client-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--white);
    border: 2px solid var(--grey-100);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.client-card:hover {
    border-color: var(--red);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.client-card:active {
    transform: translateX(4px) scale(0.98);
}

.client-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--grey-800);
}

.client-count {
    font-size: 13px;
    color: var(--grey-400);
    margin-top: 2px;
}

.card-chevron {
    color: var(--grey-300);
    font-size: 28px;
    font-weight: 300;
    transition: all 0.2s var(--ease-out);
}

.client-card:hover .card-chevron {
    color: var(--red);
    transform: translateX(4px);
}

/* ===== JOB CARDS ===== */
.job-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.job-card {
    background: var(--white);
    border: 2px solid var(--grey-100);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s var(--ease-out);
}

.job-card:hover {
    border-color: var(--grey-200);
}

.job-card.expanded {
    border-color: var(--red);
    box-shadow: 0 4px 16px rgba(237, 28, 36, 0.1);
}

.job-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.job-info {
    flex: 1;
    min-width: 0;
}

.job-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--grey-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-meta {
    font-size: 12px;
    color: var(--grey-400);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.job-meta-dot {
    width: 3px;
    height: 3px;
    background: var(--grey-300);
    border-radius: var(--radius-full);
}

.meta-icon {
    width: 14px;
    height: 14px;
    color: var(--red);
    flex-shrink: 0;
}

.job-card .card-chevron {
    font-size: 24px;
    transition: all 0.3s var(--ease-out);
}

.job-card.expanded .card-chevron {
    transform: rotate(90deg);
    color: var(--red);
}

.job-details {
    display: none;
    padding: 0 18px 18px;
    animation: slideDown 0.3s var(--ease-out);
}

.job-card.expanded .job-details {
    display: block;
}

.job-update-input {
    width: 100%;
    min-height: 70px;
    padding: 12px 14px;
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--grey-800);
    background: var(--grey-50);
    resize: none;
    margin-bottom: 12px;
    transition: all 0.2s var(--ease-out);
}

.job-update-input:focus {
    outline: none;
    border-color: var(--red);
    background: var(--white);
}

.job-update-input::placeholder {
    color: var(--grey-400);
}

.job-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--grey-100);
}

.job-detail-row:last-of-type {
    border-bottom: none;
}

.job-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.job-action-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.job-action-btn.secondary {
    background: var(--white);
    border: 1.5px solid var(--grey-200);
    color: var(--grey-600);
}

.job-action-btn.secondary:hover {
    border-color: var(--red);
    color: var(--red);
}

.job-action-btn.primary {
    background: var(--red);
    border: 1.5px solid var(--red);
    color: var(--white);
}

.job-action-btn.primary:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
}

.job-action-btn.primary:disabled {
    background: var(--grey-300);
    border-color: var(--grey-300);
    cursor: not-allowed;
}

.job-action-btn.primary.success {
    background: #22a822;
    border-color: #22a822;
}

.job-detail-label {
    font-size: 13px;
    color: var(--grey-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.job-detail-value {
    font-size: 14px;
    color: var(--grey-800);
    font-weight: 600;
}

.update-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: var(--red);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.update-btn:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 28, 36, 0.3);
}

.update-btn:active {
    transform: translateY(0);
}

/* ===== SMART PROMPTS ===== */
.smart-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.smart-prompt {
    padding: 10px 16px;
    background: var(--grey-50);
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--grey-600);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.smart-prompt:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--white);
}

.smart-prompt:active {
    transform: scale(0.96);
}

/* ===== ALSO DUE LIST ===== */
.also-due-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 16px 0;
}

.also-due-list li {
    padding: 10px 14px;
    background: var(--grey-50);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--grey-600);
}

.also-due-list li strong {
    color: var(--grey-800);
}

/* ===== CHAT INPUT ===== */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--grey-100);
    background: var(--white);
}

.chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--grey-200);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s var(--ease-out);
}

.chat-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px var(--red-glow);
}

.chat-input::placeholder {
    color: var(--grey-400);
    font-weight: 400;
}

.chat-robot {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chat-robot-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-send {
    width: 44px;
    height: 44px;
    background: var(--red);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
    color: var(--white);
    flex-shrink: 0;
}

.chat-send:hover {
    background: var(--red-dark);
    transform: scale(1.05);
}

.chat-send:active {
    transform: scale(0.95);
}

.chat-send .send-icon {
    width: 18px;
    height: 18px;
    transform: rotate(45deg);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 32px 24px;
    color: var(--grey-400);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    filter: grayscale(1);
    opacity: 0.6;
}

.empty-text {
    font-size: 15px;
    font-weight: 500;
}

/* ===== ANIMATIONS ===== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-8deg); }
    45% { transform: rotate(14deg); }
    60% { transform: rotate(-4deg); }
    75% { transform: rotate(10deg); }
}

@keyframes helloAppear {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes robotBob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

@keyframes antennaPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--red); }
    50% { opacity: 0.6; box-shadow: 0 0 2px var(--red); }
}

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-16px) scale(1.1); }
}

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

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

.fade-in {
    animation: fadeIn 0.4s var(--ease-out);
}
