@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Fredoka+One&display=swap');

/* Global Colors & Theme Variables (Indigo Velvet & Cream Sand) */
:root {
    --bg: #e8e4db;              /* warm grey/cream background */
    --bg2: #f6f4f0;             /* cream white */
    --pink: #3d5e8c;            /* primary: slate/denim blue */
    --pink-dark: #2d4a6f;       /* dark indigo */
    --blue: #223751;            /* deep indigo blue */
    --mint: #6f8db3;            /* light steel blue */
    --yellow: #e2dcd0;          /* soft sand grey */
    --purple: #89a5cb;          /* soft velvet lavender blue */
    --red: #d9a0a0;             /* pastel slate red */
    --white: #ffffff;
    --surface: rgba(255,255,255,0.85);
    --text: #12141a;            /* dark charcoal text */
    --text-muted: #5e6b7c;      /* muted slate blue */
    --border: rgba(61,94,140,0.22);
    --shadow: 0 8px 32px rgba(61,94,140,0.12);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #e8e4db 0%, #f6f4f0 50%, #fbfbf9 100%);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Background elements */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(var(--mint) 10%, transparent 11%),
        radial-gradient(var(--pink) 10%, transparent 11%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    opacity: 0.08;
    z-index: 1;
    pointer-events: none;
}

.glowing-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.12;
    z-index: 2;
    pointer-events: none;
    animation: orb-float 25s infinite alternate;
}

.orb-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--pink) 0%, var(--mint) 100%);
    top: -50px;
    right: 15%;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--blue) 0%, var(--purple) 100%);
    bottom: -100px;
    left: 15%;
    animation-delay: -7s;
}

@keyframes orb-float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 40px) scale(1.08); }
}

/* Main Grid Layout */
.app-container {
    display: flex;
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100vh;
}

/* Sidebar Design (Cute Mickey Pink/White Glass) */
.control-panel {
    width: 330px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(244,167,195,0.08);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

/* Water droplet wave logo wrapper */
.mickey-logo-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    cursor: pointer;
    background: rgba(61, 94, 140, 0.1);
    border: 1px solid var(--pink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    box-shadow: 0 0 10px rgba(61, 94, 140, 0.25);
}

.mickey-logo-wrapper:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 18px rgba(61, 94, 140, 0.5);
}

.mickey-logo-wrapper .mickey-ear {
    display: none; /* Ẩn tai mickey */
}

.mickey-logo-wrapper .mickey-face {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--blue) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 124, 240, 0.3);
}

.mickey-logo-wrapper .mickey-face i {
    font-size: 13px;
    color: #fff;
}

.brand-info h1 {
    font-family: 'Fredoka One', sans-serif;
    font-size: 19px;
    letter-spacing: 0.5px;
    color: var(--pink-dark);
}

.brand-info span {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.panel-section {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-section label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.panel-section label i {
    margin-right: 4px;
    color: var(--pink-dark);
}

/* Custom Styled Select Inputs */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select select {
    width: 100%;
    padding: 11px 15px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.custom-select select:focus {
    border-color: var(--pink-dark);
    box-shadow: 0 0 0 3px rgba(244,167,195,0.25);
}

.custom-select::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pink-dark);
    pointer-events: none;
}

.panel-section input, .panel-section textarea,
.glass-card input, .glass-card textarea {
    width: 100%;
    padding: 11px 15px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.panel-section textarea {
    resize: none;
}

.panel-section input:focus, .panel-section textarea:focus,
.glass-card input:focus, .glass-card textarea:focus {
    border-color: var(--pink-dark);
    box-shadow: 0 0 0 3px rgba(244,167,195,0.25);
}

/* Cute Gradient Buttons */
.glow-button {
    margin-top: 8px;
    padding: 13px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 16px rgba(244,167,195,0.3);
}

.glow-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 22px rgba(244,167,195,0.5);
}

.glow-button:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
}

.glow-button:disabled {
    background: #e2e8f0;
    color: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}

/* Dream Button Specifics (Mickey/Disney Purple) */
.glow-button.dream-btn {
    background: linear-gradient(135deg, var(--purple) 0%, #a78bfa 100%);
    box-shadow: 0 6px 16px rgba(167,139,250,0.25);
    margin-top: 10px;
}

.glow-button.dream-btn:hover:not(:disabled) {
    box-shadow: 0 8px 22px rgba(167,139,250,0.45);
}

/* System Status Footer in Sidebar */
.system-status {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.pulse-dot.idle {
    background-color: var(--text-muted);
}

.pulse-dot.active {
    background-color: var(--pink-dark);
    box-shadow: 0 0 10px var(--pink);
    animation: pulse 1.5s infinite;
}

.pulse-dot.success {
    background-color: #34d399;
    box-shadow: 0 0 10px #b8f0d4;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.session-info {
    font-size: 10px;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 600;
}

/* Main Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100vh;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.workspace-header h2 {
    font-family: 'Fredoka One', sans-serif;
    font-size: 20px;
    color: var(--text);
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.active-badge {
    padding: 6px 12px;
    background: rgba(244,167,195,0.08);
    border: 1px solid rgba(244,167,195,0.25);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    color: var(--pink-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    background: var(--white);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.icon-btn:hover {
    color: var(--pink-dark);
    background: rgba(244,167,195,0.08);
    border-color: var(--pink);
    transform: scale(1.05);
}

/* Grid of 8 Agent Cards (Pastel Style) */
.agents-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    overflow: hidden;
}

.agent-card {
    background: var(--white);
    border: none;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.agent-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 36px rgba(244,167,195,0.18);
}

.agent-card.running {
    box-shadow: 0 0 0 3px var(--theme-color), 0 12px 36px rgba(244,167,195,0.2);
}

.agent-card.running .agent-status-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--theme-color), transparent);
    animation: flow-glow 2s infinite linear;
}

.agent-card.success {
    box-shadow: 0 0 0 3px #34d399, 0 12px 36px rgba(184,240,212,0.2);
}

@keyframes flow-glow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Agent Colors Scheme (Pastel matching) */
#card-scout_agent { --theme-color: var(--pink); --theme-rgb: 0, 210, 255; }
#card-angle_ranker_agent { --theme-color: var(--mint); --theme-rgb: 63, 176, 172; }
#card-brief_agent { --theme-color: var(--yellow); --theme-rgb: 255, 224, 138; }
#card-affiliate_agent { --theme-color: var(--blue); --theme-rgb: 0, 124, 240; }
#card-writer_agent { --theme-color: var(--purple); --theme-rgb: 139, 92, 246; }
#card-critic_agent { --theme-color: var(--red); --theme-rgb: 255, 179, 186; }
#card-orchestrator_agent { --theme-color: var(--blue); --theme-rgb: 0, 124, 240; }
#card-psychologist_strategist { --theme-color: var(--purple); --theme-rgb: 139, 92, 246; }

/* Affiliate Agent Suite Colors */
#card-aff_research_agent { --theme-color: var(--pink); --theme-rgb: 0, 210, 255; }
#card-aff_content_agent { --theme-color: var(--mint); --theme-rgb: 63, 176, 172; }
#card-aff_blog_seo_agent { --theme-color: var(--yellow); --theme-rgb: 255, 224, 138; }
#card-aff_landing_agent { --theme-color: var(--blue); --theme-rgb: 0, 124, 240; }
#card-aff_distribution_agent { --theme-color: var(--purple); --theme-rgb: 139, 92, 246; }
#card-aff_analytics_agent { --theme-color: var(--red); --theme-rgb: 255, 179, 186; }
#card-aff_automation_agent { --theme-color: var(--blue); --theme-rgb: 0, 124, 240; }
#card-aff_meta_agent { --theme-color: var(--purple); --theme-rgb: 139, 92, 246; }


/* Header of Agent Cards */
.agent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(244,167,195,0.03);
    border-bottom: 1px solid var(--border);
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: rgba(var(--theme-rgb), 0.25);
    color: var(--text);
    border: 1px solid rgba(var(--theme-rgb), 0.4);
}

.agent-title h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}

.agent-title span {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Chat Output Panel Inside Card */
.chat-area {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
    line-height: 1.6;
    background: #fafafc;
}

.chat-area::-webkit-scrollbar {
    width: 4px;
}

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

.chat-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 20px;
}

.system-msg {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Message styling inside agent chat */
.msg-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(244,167,195,0.04);
}

.msg-item.tool {
    background: rgba(var(--theme-rgb), 0.05);
    border-color: rgba(var(--theme-rgb), 0.2);
}

.msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(244,167,195,0.15);
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.author-badge {
    font-size: 9px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.msg-meta .time {
    font-size: 9px;
    color: var(--text-muted);
}

.msg-content {
    color: var(--text);
}

.tool-call-msg {
    color: var(--text);
    font-weight: 700;
}

/* 🤖 WORKFLOW VISUALIZER MAP 🤖 */
.workflow-map-card {
    background: var(--white);
    border: none;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: var(--shadow);
}

.workflow-map-title {
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.workflow-map-title i {
    color: var(--pink-dark);
}

.flow-node circle {
    fill: var(--white);
    stroke-width: 2.5;
}

.flow-node.active circle {
    fill: var(--white);
    stroke-width: 4;
    filter: drop-shadow(0 0 6px var(--node-color));
}

.flow-node.active text.node-label {
    fill: var(--text);
    font-weight: 800;
}

/* Tarot Workspace Layout */
.tarot-tab-btn {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
}

.tarot-tab-btn.active {
    background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
    border-color: var(--pink);
    color: #fff;
    box-shadow: 0 4px 15px rgba(244, 167, 195, 0.3);
}

.tarot-tab-btn:hover:not(.active) {
    background: rgba(244, 167, 195, 0.08);
    color: var(--pink-dark);
}

.tarot-grid-box {
    background: var(--white);
    border: none;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.tarot-grid-box.color-purple { border-left: 5px solid var(--purple); }
.tarot-grid-box.color-cyan { border-left: 5px solid var(--blue); }
.tarot-grid-box.color-gold { border-left: 5px solid var(--yellow); }
.tarot-grid-box.color-green { border-left: 5px solid var(--mint); }

.tarot-grid-box-title {
    font-family: 'Fredoka One', sans-serif;
    font-size: 12px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 15px;
}

/* Modal Styling */
.report-editor-modal {
    background: rgba(8, 7, 16, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal-content {
    background: var(--white);
    border: none;
    border-radius: 24px;
    box-shadow: 0 15px 50px rgba(244,167,195,0.15);
}

.modal-header h2 {
    font-family: 'Fredoka One', sans-serif;
    font-size: 17px;
    color: var(--pink-dark);
}

.modal-body label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
}

.modal-body input, .modal-body textarea {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
}

.modal-body input:focus, .modal-body textarea:focus {
    border-color: var(--pink-dark);
    box-shadow: 0 0 0 3px rgba(244,167,195,0.25);
    background: var(--white);
}

.modal-footer {
    border-top: 1px solid var(--border);
}

/* Dreaming Overlay */
.dreaming-overlay {
    background: rgba(253, 240, 247, 0.95);
    backdrop-filter: blur(15px);
}

.dream-ring {
    border-top-color: var(--pink);
    border-bottom-color: var(--purple);
}

.dream-ring-inner {
    border-left-color: var(--blue);
    border-right-color: var(--mint);
}

.dream-icon {
    color: var(--pink-dark);
}

.dreaming-text h2 {
    font-family: 'Fredoka One', sans-serif;
    background: linear-gradient(135deg, var(--pink-dark) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dreaming-text p {
    color: var(--text-muted);
    font-weight: 700;
}

/* Tarot Mini Cards Pulse Styling */
.tarot-mini-card.running {
    border-color: var(--pink) !important;
    box-shadow: 0 0 14px rgba(61, 94, 140, 0.5) !important;
    animation: mini-card-pulse 1.2s infinite alternate ease-in-out;
    background: rgba(61, 94, 140, 0.08) !important;
}

@keyframes mini-card-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.04); }
}
