/* Australian Stock Market Screen AI - WordPress Plugin Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --ass-white: #ffffff;
    --ass-off-white: #f8f9fa;
    --ass-border: #e8eaed;
    --ass-border-light: #f1f3f5;
    --ass-text-primary: #1a1d23;
    --ass-text-secondary: #5f6368;
    --ass-text-muted: #9aa0a6;
    --ass-green: #00875a;
    --ass-green-light: #e6f4ee;
    --ass-green-mid: #00a86b;
    --ass-red: #d93025;
    --ass-red-light: #fce8e6;
    --ass-blue: #1a73e8;
    --ass-blue-light: #e8f0fe;
    --ass-gold: #f9ab00;
    --ass-gold-light: #fef8e1;
    --ass-purple: #7c3aed;
    --ass-shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --ass-shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --ass-shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --ass-radius: 12px;
    --ass-radius-sm: 8px;
    --ass-radius-xs: 6px;
    --ass-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --ass-mono: 'JetBrains Mono', monospace;
}

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

/* ===== WRAPPER ===== */
.ass-wrapper {
    font-family: var(--ass-font);
    background: var(--ass-white);
    border: 1px solid var(--ass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--ass-shadow-lg);
    max-width: 1200px;
    margin: 0 auto;
    color: var(--ass-text-primary);
    line-height: 1.5;
}

/* ===== HEADER ===== */
.ass-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--ass-white);
    border-bottom: 1px solid var(--ass-border);
    gap: 12px;
    flex-wrap: wrap;
}

.ass-header-left, .ass-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ass-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ass-logo-icon {
    font-size: 28px;
    line-height: 1;
}

.ass-logo-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ass-text-primary);
    letter-spacing: -0.3px;
}

.ass-logo-sub {
    font-size: 11px;
    color: var(--ass-text-muted);
    font-weight: 400;
    margin-top: 1px;
}

.ass-market-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--ass-off-white);
    border: 1px solid var(--ass-border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ass-text-secondary);
}

.ass-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ass-green);
    box-shadow: 0 0 0 2px var(--ass-green-light);
    animation: ass-pulse 2s infinite;
}

@keyframes ass-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== SEARCH SECTION ===== */
.ass-search-section {
    padding: 16px 24px;
    background: linear-gradient(135deg, #f0f7f4 0%, #f8f9fa 100%);
    border-bottom: 1px solid var(--ass-border);
}

.ass-search-bar {
    display: flex;
    align-items: center;
    background: var(--ass-white);
    border: 2px solid var(--ass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ass-search-bar:focus-within {
    border-color: var(--ass-green);
    box-shadow: 0 0 0 3px rgba(0,135,90,0.12);
}

.ass-search-icon {
    padding: 0 12px 0 16px;
    font-size: 16px;
    color: var(--ass-text-muted);
    flex-shrink: 0;
}

.ass-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--ass-font);
    font-size: 15px;
    color: var(--ass-text-primary);
    padding: 12px 8px;
    background: transparent;
    min-width: 0;
}

.ass-search-input::placeholder { color: var(--ass-text-muted); }

.ass-mode-select-wrap {
    border-left: 1px solid var(--ass-border);
    flex-shrink: 0;
}

.ass-mode-select {
    border: none;
    outline: none;
    font-family: var(--ass-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--ass-text-secondary);
    background: transparent;
    padding: 12px 10px;
    cursor: pointer;
    min-width: 140px;
}

.ass-search-btn {
    border: none;
    outline: none;
    background: var(--ass-green);
    color: white;
    font-family: var(--ass-font);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.ass-search-btn:hover { background: #006b47; }

/* ===== MAIN LAYOUT ===== */
.ass-main {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 580px;
    max-height: 700px;
}

/* ===== SIDEBAR ===== */
.ass-sidebar {
    border-right: 1px solid var(--ass-border);
    overflow-y: auto;
    background: var(--ass-off-white);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ass-sidebar::-webkit-scrollbar { width: 4px; }
.ass-sidebar::-webkit-scrollbar-track { background: transparent; }
.ass-sidebar::-webkit-scrollbar-thumb { background: var(--ass-border); border-radius: 2px; }

/* ===== PANELS ===== */
.ass-panel {
    background: var(--ass-white);
    border: 1px solid var(--ass-border);
    border-radius: var(--ass-radius-sm);
    padding: 14px;
}

.ass-panel-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ass-text-muted);
    margin-bottom: 10px;
}

/* Stock Grid */
.ass-stock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ass-stock-chip {
    border: 1px solid var(--ass-border);
    background: var(--ass-white);
    border-radius: var(--ass-radius-xs);
    padding: 7px 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ass-stock-chip:hover {
    border-color: var(--ass-green);
    background: var(--ass-green-light);
}

.ass-stock-chip.ass-active {
    border-color: var(--ass-green);
    background: var(--ass-green-light);
}

.ass-chip-ticker {
    font-size: 12px;
    font-weight: 700;
    color: var(--ass-text-primary);
    font-family: var(--ass-mono);
}

.ass-chip-name {
    font-size: 10px;
    color: var(--ass-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Quick Queries */
.ass-quick-queries {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ass-quick-btn {
    border: 1px solid var(--ass-border);
    background: var(--ass-white);
    border-radius: var(--ass-radius-xs);
    padding: 8px 10px;
    font-family: var(--ass-font);
    font-size: 12px;
    color: var(--ass-text-secondary);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    line-height: 1.4;
}

.ass-quick-btn:hover {
    border-color: var(--ass-blue);
    color: var(--ass-blue);
    background: var(--ass-blue-light);
}

/* Disclaimer */
.ass-disclaimer {
    background: var(--ass-gold-light);
    border-color: #f9ab0040;
}

.ass-disclaimer p {
    font-size: 11px;
    color: #7a5a00;
    line-height: 1.5;
}

/* ===== CONTENT AREA ===== */
.ass-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ass-white);
}

/* Welcome */
.ass-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    text-align: center;
}

.ass-welcome-icon { font-size: 48px; margin-bottom: 16px; }
.ass-welcome-title { font-size: 22px; font-weight: 700; color: var(--ass-text-primary); margin-bottom: 10px; letter-spacing: -0.4px; }
.ass-welcome-sub { font-size: 14px; color: var(--ass-text-secondary); max-width: 480px; line-height: 1.6; margin-bottom: 28px; }

.ass-welcome-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 480px;
}

.ass-feature-card {
    background: var(--ass-off-white);
    border: 1px solid var(--ass-border);
    border-radius: var(--ass-radius-sm);
    padding: 14px;
    text-align: left;
}

.ass-feature-icon { font-size: 20px; margin-bottom: 6px; }
.ass-feature-title { font-size: 13px; font-weight: 700; color: var(--ass-text-primary); margin-bottom: 3px; }
.ass-feature-desc { font-size: 11px; color: var(--ass-text-muted); line-height: 1.4; }

/* Chat container */
.ass-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: none;
}

.ass-chat-container::-webkit-scrollbar { width: 4px; }
.ass-chat-container::-webkit-scrollbar-track { background: transparent; }
.ass-chat-container::-webkit-scrollbar-thumb { background: var(--ass-border); border-radius: 2px; }

.ass-messages { display: flex; flex-direction: column; gap: 16px; }

/* Message Bubbles */
.ass-message { display: flex; gap: 10px; animation: ass-fade-in 0.3s ease; }

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

.ass-message.ass-user { flex-direction: row-reverse; }

.ass-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.ass-message.ass-ai .ass-msg-avatar { background: var(--ass-green-light); border: 1px solid rgba(0,135,90,0.2); }
.ass-message.ass-user .ass-msg-avatar { background: var(--ass-blue-light); border: 1px solid rgba(26,115,232,0.2); }

.ass-msg-body { flex: 1; max-width: 85%; }

.ass-msg-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    color: var(--ass-text-muted);
}

.ass-message.ass-user .ass-msg-label { text-align: right; }

.ass-msg-bubble {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--ass-text-primary);
}

.ass-message.ass-ai .ass-msg-bubble {
    background: var(--ass-off-white);
    border: 1px solid var(--ass-border);
    border-top-left-radius: 4px;
}

.ass-message.ass-user .ass-msg-bubble {
    background: var(--ass-blue);
    color: white;
    border-top-right-radius: 4px;
}

/* Markdown Rendering in AI Messages */
.ass-msg-bubble h1, .ass-msg-bubble h2, .ass-msg-bubble h3 {
    font-weight: 700;
    margin: 12px 0 6px;
    color: var(--ass-text-primary);
    letter-spacing: -0.3px;
}
.ass-msg-bubble h1 { font-size: 18px; }
.ass-msg-bubble h2 { font-size: 15px; border-bottom: 1px solid var(--ass-border); padding-bottom: 4px; }
.ass-msg-bubble h3 { font-size: 14px; }
.ass-msg-bubble p { margin-bottom: 8px; }
.ass-msg-bubble ul, .ass-msg-bubble ol { padding-left: 20px; margin-bottom: 8px; }
.ass-msg-bubble li { margin-bottom: 3px; }
.ass-msg-bubble strong { font-weight: 700; }
.ass-msg-bubble em { font-style: italic; }
.ass-msg-bubble code {
    font-family: var(--ass-mono);
    font-size: 12px;
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 3px;
}
.ass-msg-bubble pre {
    background: #1e2028;
    color: #e8eaed;
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 12px;
    font-family: var(--ass-mono);
}
.ass-msg-bubble blockquote {
    border-left: 3px solid var(--ass-green);
    padding-left: 12px;
    color: var(--ass-text-secondary);
    font-style: italic;
    margin: 8px 0;
}
.ass-msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 8px 0;
}
.ass-msg-bubble th {
    background: var(--ass-green-light);
    color: var(--ass-green);
    font-weight: 700;
    padding: 7px 10px;
    border: 1px solid var(--ass-border);
    text-align: left;
}
.ass-msg-bubble td {
    padding: 6px 10px;
    border: 1px solid var(--ass-border);
}
.ass-msg-bubble tr:nth-child(even) td { background: var(--ass-off-white); }

/* Disclaimer chip on AI messages */
.ass-msg-disclaimer {
    font-size: 11px;
    color: var(--ass-text-muted);
    margin-top: 6px;
    padding: 5px 8px;
    background: var(--ass-gold-light);
    border-radius: var(--ass-radius-xs);
    border: 1px solid rgba(249,171,0,0.25);
}

/* Loading */
.ass-loading {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ass-loading-dots {
    display: flex;
    gap: 6px;
}

.ass-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ass-green);
    animation: ass-bounce 1.2s infinite;
}
.ass-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.ass-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ass-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-6px); opacity: 1; }
}

.ass-loading-text { font-size: 13px; color: var(--ass-text-muted); }

/* ===== INPUT AREA ===== */
.ass-input-area {
    border-top: 1px solid var(--ass-border);
    padding: 12px 16px;
    background: var(--ass-white);
}

.ass-active-stock {
    font-size: 12px;
    color: var(--ass-green);
    font-weight: 500;
    background: var(--ass-green-light);
    padding: 5px 10px;
    border-radius: var(--ass-radius-xs);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(0,135,90,0.2);
}

.ass-clear-stock {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--ass-green);
    padding: 0 2px;
    line-height: 1;
}

.ass-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ass-chat-input {
    flex: 1;
    border: 2px solid var(--ass-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: var(--ass-font);
    font-size: 14px;
    color: var(--ass-text-primary);
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
    background: var(--ass-off-white);
}

.ass-chat-input:focus {
    border-color: var(--ass-green);
    background: white;
    box-shadow: 0 0 0 3px rgba(0,135,90,0.10);
}

.ass-chat-input::placeholder { color: var(--ass-text-muted); }

.ass-send-btn {
    border: none;
    outline: none;
    background: var(--ass-green);
    color: white;
    font-family: var(--ass-font);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
    height: 42px;
}

.ass-send-btn:hover { background: #006b47; }
.ass-send-btn:active { transform: scale(0.97); }
.ass-send-btn:disabled { background: var(--ass-text-muted); cursor: not-allowed; }

.ass-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 7px;
}

.ass-model-tag {
    font-size: 11px;
    color: var(--ass-text-muted);
    font-weight: 500;
}

.ass-input-hint {
    font-size: 11px;
    color: var(--ass-text-muted);
}

/* ===== ERROR STATE ===== */
.ass-error-msg {
    background: var(--ass-red-light);
    border: 1px solid rgba(217,48,37,0.2);
    border-radius: var(--ass-radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    color: var(--ass-red);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .ass-wrapper { border-radius: 10px; }
    
    .ass-main {
        grid-template-columns: 1fr;
        max-height: none;
    }
    
    .ass-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--ass-border);
        max-height: 280px;
    }
    
    .ass-content { min-height: 500px; }
    
    .ass-search-bar { flex-wrap: wrap; }
    
    .ass-mode-select-wrap { border-left: none; border-top: 1px solid var(--ass-border); width: 100%; }
    .ass-mode-select { width: 100%; }
    .ass-search-btn { width: 100%; }
    
    .ass-welcome-features { grid-template-columns: 1fr 1fr; }
    
    .ass-header { padding: 12px 16px; }
    .ass-search-section { padding: 12px 16px; }
    
    .ass-logo-title { font-size: 15px; }
    
    .ass-welcome { padding: 24px 16px; }
    .ass-welcome-title { font-size: 18px; }
}

@media (max-width: 480px) {
    .ass-header-right { display: none; }
    .ass-welcome-features { grid-template-columns: 1fr; }
    .ass-stock-grid { grid-template-columns: repeat(3, 1fr); }
}
