/* ==========================================================================
   Syntro Build AI — Dashboard CSS  (Module 1)
   Stack: TailwindCSS (utility layer) + custom design tokens (this file)
   Dark mode: class strategy (.dark on <html>)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand */
    --c-brand:       #6366f1;  /* indigo-500  */
    --c-brand-hover: #4f46e5;  /* indigo-600  */
    --c-brand-glow:  rgba(99, 102, 241, 0.25);

    /* Surface — light */
    --c-bg:          #f8fafc;
    --c-surface:     #ffffff;
    --c-surface-2:   #f1f5f9;
    --c-border:      #e2e8f0;

    /* Text — light */
    --c-text:        #0f172a;
    --c-text-2:      #475569;
    --c-text-3:      #94a3b8;

    /* Chat */
    --c-bubble-user: #6366f1;
    --c-bubble-ai:   #f1f5f9;

    /* Radius / spacing */
    --radius-sm:     6px;
    --radius-md:     12px;
    --radius-lg:     20px;
    --radius-full:   9999px;

    /* Transition */
    --transition:    150ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Navbar */
    --navbar-h:      60px;
}

.dark {
    --c-bg:          #0f172a;
    --c-surface:     #1e293b;
    --c-surface-2:   #334155;
    --c-border:      #334155;
    --c-text:        #f1f5f9;
    --c-text-2:      #94a3b8;
    --c-text-3:      #64748b;
    --c-bubble-user: #6366f1;
    --c-bubble-ai:   #1e293b;
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

/* --------------------------------------------------------------------------
   3. Navbar
   -------------------------------------------------------------------------- */
.navbar {
    position:        fixed;
    top:             0;
    left:            0;
    right:           0;
    height:          var(--navbar-h);
    z-index:         100;
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         0 1.25rem;
    background:      var(--c-surface);
    border-bottom:   1px solid var(--c-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.navbar__brand {
    display:     flex;
    align-items: center;
    gap:         0.5rem;
    font-weight: 700;
    font-size:   1.05rem;
    color:       var(--c-text);
    text-decoration: none;
}

.navbar__brand-icon { font-size: 1.25rem; }

.navbar__brand-name { letter-spacing: -0.01em; }

/* Right-side actions cluster */
.navbar__actions {
    display:     flex;
    align-items: center;
    gap:         0.5rem;
}

/* Generic icon button */
.navbar__icon-btn {
    display:          flex;
    align-items:      center;
    justify-content:  center;
    width:            36px;
    height:           36px;
    border:           none;
    border-radius:    var(--radius-md);
    background:       transparent;
    color:            var(--c-text-2);
    cursor:           pointer;
    position:         relative;
    transition:       background var(--transition), color var(--transition);
}

.navbar__icon-btn:hover {
    background: var(--c-surface-2);
    color:      var(--c-text);
}

/* Credits pill */
.navbar__credits {
    display:      flex;
    align-items:  center;
    gap:          0.35rem;
    font-size:    0.8rem;
    font-weight:  600;
    color:        var(--c-brand);
    background:   rgba(99, 102, 241, 0.1);
    padding:      0.25rem 0.6rem;
    border-radius: var(--radius-full);
}

.navbar__credits-label { color: var(--c-text-3); font-weight: 400; }

/* Badge */
.navbar__badge {
    position:         absolute;
    top:              4px;
    right:            4px;
    min-width:        16px;
    height:           16px;
    padding:          0 3px;
    font-size:        0.65rem;
    font-weight:      700;
    line-height:      16px;
    text-align:       center;
    background:       #ef4444;
    color:            #fff;
    border-radius:    var(--radius-full);
    border:           2px solid var(--c-surface);
    transition:       opacity var(--transition);
}

.navbar__badge--hidden { opacity: 0; pointer-events: none; }

/* Dropdown base */
.navbar__dropdown {
    position:         absolute;
    top:              calc(100% + 8px);
    right:            0;
    background:       var(--c-surface);
    border:           1px solid var(--c-border);
    border-radius:    var(--radius-md);
    box-shadow:       0 8px 30px rgba(0,0,0,0.12);
    z-index:          200;
    overflow:         hidden;
}

.navbar__notif-wrap,
.navbar__profile-wrap {
    position: relative;
}

.navbar__dropdown--notif  { width: 320px; }
.navbar__dropdown--profile { width: 220px; }

/* Dropdown header */
.navbar__dropdown-header {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    padding:         0.65rem 1rem;
    font-size:       0.8rem;
    font-weight:     600;
    border-bottom:   1px solid var(--c-border);
    color:           var(--c-text);
}

.navbar__dropdown-action {
    font-size:  0.75rem;
    color:      var(--c-brand);
    background: none;
    border:     none;
    cursor:     pointer;
    padding:    0;
}

.navbar__dropdown-action:hover { text-decoration: underline; }

/* Notification list */
.navbar__notif-list { list-style: none; max-height: 320px; overflow-y: auto; }

.navbar__notif-item {
    padding:       0.65rem 1rem;
    border-bottom: 1px solid var(--c-border);
    transition:    background var(--transition);
}

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

.navbar__notif-item--unread { background: rgba(99,102,241,0.05); }

.navbar__notif-title {
    display:     block;
    font-size:   0.8rem;
    font-weight: 600;
    color:       var(--c-text);
}

.navbar__notif-body {
    font-size:  0.75rem;
    color:      var(--c-text-2);
    margin-top: 2px;
}

.navbar__notif-time {
    display:    block;
    font-size:  0.7rem;
    color:      var(--c-text-3);
    margin-top: 4px;
}

.navbar__notif-empty {
    padding:    1rem;
    text-align: center;
    font-size:  0.8rem;
    color:      var(--c-text-3);
}

/* Profile dropdown */
.navbar__profile-info {
    padding:        0.75rem 1rem;
    border-bottom:  1px solid var(--c-border);
}

.navbar__profile-name  { display: block; font-size: 0.85rem; font-weight: 600; color: var(--c-text); }
.navbar__profile-email { display: block; font-size: 0.75rem; color: var(--c-text-3); margin-top: 1px; word-break: break-all; }

.navbar__menu-item {
    display:    block;
    padding:    0.55rem 1rem;
    font-size:  0.85rem;
    color:      var(--c-text);
    transition: background var(--transition);
    cursor:     pointer;
}

.navbar__menu-item:hover { background: var(--c-surface-2); text-decoration: none; }
.navbar__menu-item--danger { color: #ef4444; }
.navbar__menu-item--danger:hover { background: rgba(239,68,68,0.08); }

.navbar__divider { border: none; border-top: 1px solid var(--c-border); }

/* Avatar button */
.navbar__avatar-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           36px;
    height:          36px;
    border-radius:   var(--radius-full);
    border:          2px solid var(--c-border);
    background:      var(--c-brand);
    cursor:          pointer;
    overflow:        hidden;
    padding:         0;
    transition:      border-color var(--transition);
}

.navbar__avatar-btn:hover { border-color: var(--c-brand); }

.navbar__avatar-img { width: 100%; height: 100%; object-fit: cover; }

.navbar__avatar-initials {
    font-size:   0.8rem;
    font-weight: 700;
    color:       #fff;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.dashboard-body {
    display:        flex;
    flex-direction: column;
    min-height:     100vh;
    background:     var(--c-bg);
}

.dashboard-main {
    flex:          1;
    display:       flex;
    align-items:   stretch;
    padding-top:   var(--navbar-h);
}

.dashboard-container {
    width:      100%;
    max-width:  800px;
    margin:     0 auto;
    display:    flex;
    flex-direction: column;
    height:     calc(100vh - var(--navbar-h));
}

/* --------------------------------------------------------------------------
   5. Chat Window
   -------------------------------------------------------------------------- */
.chat-window {
    display:        flex;
    flex-direction: column;
    flex:           1;
    overflow:       hidden;
}

/* Message list */
.chat-window__messages {
    flex:        1;
    overflow-y:  auto;
    padding:     1.5rem 1rem 1rem;
    scroll-behavior: smooth;
}

/* Scrollbar */
.chat-window__messages::-webkit-scrollbar { width: 6px; }
.chat-window__messages::-webkit-scrollbar-track { background: transparent; }
.chat-window__messages::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

/* Input area */
.chat-window__input-wrap {
    padding:       0.75rem 1rem 1rem;
    border-top:    1px solid var(--c-border);
    background:    var(--c-surface);
}

.chat-window__form { display: flex; flex-direction: column; gap: 0.35rem; }

.chat-window__input-row {
    display:       flex;
    align-items:   flex-end;
    gap:           0.5rem;
    background:    var(--c-surface-2);
    border:        1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding:       0.5rem 0.5rem 0.5rem 1rem;
    transition:    border-color var(--transition), box-shadow var(--transition);
}

.chat-window__input-row:focus-within {
    border-color: var(--c-brand);
    box-shadow:   0 0 0 3px var(--c-brand-glow);
}

.chat-window__textarea {
    flex:       1;
    border:     none;
    background: transparent;
    resize:     none;
    font-size:  0.95rem;
    color:      var(--c-text);
    line-height: 1.5;
    min-height: 24px;
    max-height: 200px;
    outline:    none;
    padding:    0;
    overflow-y: auto;
}

.chat-window__textarea::placeholder { color: var(--c-text-3); }

.chat-window__send-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           36px;
    height:          36px;
    flex-shrink:     0;
    border:          none;
    border-radius:   var(--radius-md);
    background:      var(--c-brand);
    color:           #fff;
    cursor:          pointer;
    transition:      background var(--transition), transform var(--transition);
}

.chat-window__send-btn:hover  { background: var(--c-brand-hover); }
.chat-window__send-btn:active { transform: scale(0.92); }
.chat-window__send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.chat-window__hint {
    font-size:  0.7rem;
    color:      var(--c-text-3);
    text-align: center;
}

.chat-window__hint kbd {
    display:       inline-block;
    padding:       1px 5px;
    font-size:     0.65rem;
    background:    var(--c-surface-2);
    border:        1px solid var(--c-border);
    border-radius: 3px;
    font-family:   monospace;
}

/* --------------------------------------------------------------------------
   6. Message Bubbles
   -------------------------------------------------------------------------- */
.bubble-wrap {
    display:       flex;
    gap:           0.65rem;
    margin-bottom: 1.25rem;
    animation:     bubbleIn 200ms ease both;
}

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

.bubble-wrap--user      { flex-direction: row-reverse; }
.bubble-wrap--assistant { flex-direction: row; }

/* Avatars */
.bubble__avatar {
    width:            32px;
    height:           32px;
    border-radius:    var(--radius-full);
    flex-shrink:      0;
    display:          flex;
    align-items:      center;
    justify-content:  center;
    font-size:        0.8rem;
    font-weight:      700;
    overflow:         hidden;
    align-self:       flex-end;
}

.bubble__avatar--assistant { background: var(--c-brand); color: #fff; }
.bubble__avatar--user      { background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); }
.bubble__avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Bubble body */
.bubble__body { display: flex; flex-direction: column; max-width: 75%; }

.bubble-wrap--user .bubble__body { align-items: flex-end; }
.bubble-wrap--assistant .bubble__body { align-items: flex-start; }

.bubble {
    padding:       0.65rem 0.9rem;
    border-radius: var(--radius-lg);
    font-size:     0.92rem;
    line-height:   1.6;
    word-break:    break-word;
}

.bubble--user {
    background:    var(--c-bubble-user);
    color:         #fff;
    border-bottom-right-radius: var(--radius-sm);
}

.bubble--assistant {
    background:    var(--c-bubble-ai);
    color:         var(--c-text);
    border:        1px solid var(--c-border);
    border-bottom-left-radius: var(--radius-sm);
}

.bubble__content { white-space: pre-wrap; }

.bubble__time {
    font-size:  0.68rem;
    color:      var(--c-text-3);
    margin-top: 4px;
    padding:    0 0.2rem;
}

/* Typing dots */
.bubble__typing {
    display:     inline-flex;
    align-items: center;
    gap:         4px;
    padding:     4px 2px;
}

.bubble__typing span {
    display:          block;
    width:            7px;
    height:           7px;
    background:       var(--c-text-3);
    border-radius:    var(--radius-full);
    animation:        typing 1.2s infinite ease-in-out;
}

.bubble__typing span:nth-child(2) { animation-delay: 0.2s; }
.bubble__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1;   }
}

/* --------------------------------------------------------------------------
   7. Suggestions (empty state)
   -------------------------------------------------------------------------- */
.suggestions {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    flex:            1;
    padding:         2rem 1rem;
    text-align:      center;
}

.suggestions__hero { margin-bottom: 2.5rem; }

.suggestions__logo {
    font-size:   3rem;
    margin-bottom: 1rem;
    animation:   floatLogo 3s ease-in-out infinite;
}

@keyframes floatLogo {
    0%,100% { transform: translateY(0);    }
    50%     { transform: translateY(-8px); }
}

.suggestions__headline {
    font-size:   1.75rem;
    font-weight: 700;
    color:       var(--c-text);
    letter-spacing: -0.02em;
}

.suggestions__subline {
    font-size:   1rem;
    color:       var(--c-text-2);
    margin-top:  0.5rem;
}

.suggestions__grid {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap:                   0.75rem;
    width:                 100%;
    max-width:             640px;
}

.suggestions__card {
    display:         flex;
    align-items:     center;
    gap:             0.65rem;
    padding:         0.8rem 1rem;
    background:      var(--c-surface);
    border:          1px solid var(--c-border);
    border-radius:   var(--radius-md);
    cursor:          pointer;
    text-align:      left;
    font-size:       0.88rem;
    color:           var(--c-text);
    font-weight:     500;
    transition:      border-color var(--transition), box-shadow var(--transition),
                     background var(--transition), transform var(--transition);
}

.suggestions__card:hover {
    border-color: var(--c-brand);
    box-shadow:   0 0 0 3px var(--c-brand-glow);
    background:   var(--c-surface-2);
    transform:    translateY(-2px);
}

.suggestions__card:active { transform: scale(0.97); }

.suggestions__card-icon { font-size: 1.2rem; flex-shrink: 0; }
.suggestions__card-text  { line-height: 1.3; }

/* --------------------------------------------------------------------------
   8. Toast / error banner
   -------------------------------------------------------------------------- */
.toast-container {
    position:  fixed;
    bottom:    1.5rem;
    right:     1.5rem;
    z-index:   500;
    display:   flex;
    flex-direction: column;
    gap:       0.5rem;
}

.toast {
    display:       flex;
    align-items:   center;
    gap:           0.5rem;
    padding:       0.7rem 1rem;
    border-radius: var(--radius-md);
    font-size:     0.85rem;
    font-weight:   500;
    color:         #fff;
    box-shadow:    0 4px 20px rgba(0,0,0,0.15);
    animation:     toastIn 250ms ease both;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0);    }
}

.toast--error   { background: #ef4444; }
.toast--success { background: #22c55e; }
.toast--info    { background: var(--c-brand); }

/* --------------------------------------------------------------------------
   9. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .navbar { padding: 0 0.75rem; }
    .navbar__brand-name { display: none; }
    .navbar__credits-label { display: none; }

    .dashboard-container { max-width: 100%; }

    .chat-window__messages { padding: 1rem 0.5rem; }
    .chat-window__input-wrap { padding: 0.5rem 0.5rem 0.75rem; }

    .bubble__body { max-width: 88%; }

    .suggestions__headline { font-size: 1.35rem; }
    .suggestions__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
    .suggestions__grid { grid-template-columns: 1fr; }
}
