@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-primary: #FFFFFF;
  --bg-secondary: #FAFAFA;
  --bg-tertiary: #F0F0F0;
  
  /* Brand Navy */
  --navy-primary: #0A192F;
  --navy-secondary: #112240;
  --navy-light: #233554;
  
  /* Stainless Steel Elements */
  --steel-bg: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 100%);
  --steel-border: #DEE2E6;
  --steel-text: #495057;
  
  /* Text */
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  
  /* Other UI Elements */
  --border-light: #E5E7EB;
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--navy-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--navy-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

/* Utilities */
.steel-panel {
  background: var(--steel-bg);
  border: 1px solid var(--steel-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 4px rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-md);
  color: var(--steel-text);
}

.steel-panel:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--navy-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--navy-secondary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn-steel {
  background: var(--steel-bg);
  border: 1px solid var(--steel-border);
  color: var(--navy-primary);
}

.btn-steel:hover {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
  border-color: #CED4DA;
}

.hidden {
  display: none !important;
}

/* Layout */
.crm-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg-secondary);
}

.outline-border {
  border-right: 1px solid var(--steel-border);
}

.outline-border-bottom {
  border-bottom: 1px solid var(--border-light);
}

.crm-sidebar {
  width: 250px;
  background: linear-gradient(120deg, rgba(233,236,239,0.2) 0%, rgba(248,249,250,0.5) 50%, rgba(222,226,230,0.2) 100%);
  background-size: 200% 200%;
  animation: silverShine 15s ease infinite;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  border-right: 1px solid var(--steel-border);
}

@keyframes silverShine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.brand-container { margin-bottom: 2.5rem; }
.brand-logo { font-size: 1.2rem; font-weight: 700; color: var(--navy-primary); letter-spacing: 0.1em; font-family: serif; }
.brand-subtitle { font-size: 0.65rem; color: var(--text-secondary); margin-top: 0.25rem; letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

.nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.nav-item.active { background: var(--steel-bg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.02); border: 1px solid var(--steel-border); color: var(--navy-primary); }

.view { display: none; flex: 1; overflow: hidden; background: var(--bg-secondary); }
.view.active { display: flex; }

/* Inbox View */
.inbox-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  width: 100%;
}

.contacts-list {
  width: 300px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  z-index: 10;
  border-right: 1px solid var(--steel-border);
  box-shadow: 2px 0 10px rgba(0,0,0,0.01);
}

.contacts-header { padding: 1.25rem; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.contacts-header h3 { font-size: 1rem; margin: 0; }
.new-lead-btn { font-size: 0.75rem; padding: 0.4rem 0.8rem; height: auto; }

.contacts-scroller { flex: 1; overflow-y: auto; }
.contact-item { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.15s; }
.contact-item:hover { background: var(--bg-secondary); }
.contact-item.selected { background: var(--bg-tertiary); border-left: 3px solid var(--navy-primary); }
.contact-name { font-weight: 600; font-size: 0.95rem; color: var(--navy-primary); }
.contact-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.2rem; display: flex; justify-content: space-between; align-items: center; }

.status-badge { font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: var(--radius-sm); font-weight: 600; text-transform: uppercase; }
.status-badge.sp-pending { background: #FFF3CD; color: #856404; }
.status-badge.sp-won { background: #D4EDDA; color: #155724; }
.status-badge.sp-lost { background: #F8D7DA; color: #721C24; }

.conversation-view { flex: 1; display: flex; flex-direction: column; background: var(--bg-secondary); position: relative; }

.slide-in {
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.convo-header { padding: 1.5rem 2rem; background: var(--bg-primary); border-bottom: 1px solid var(--border-light); }
.convo-header h2 { font-size: 1.2rem; margin-bottom: 0.25rem; }
.convo-meta-row { font-size: 0.85rem; color: var(--text-secondary); display: flex; gap: 1rem; margin-top: 0.5rem;}
.convo-meta-item strong { color: var(--text-primary); font-weight: 500; }

.timeline-tabs { display: flex; border-bottom: 1px solid var(--border-light); padding: 0 2rem; background: var(--bg-primary); }
.timeline-tab { padding: 0.8rem 1rem; font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
.timeline-tab:hover { color: var(--navy-primary); }
.timeline-tab.active { color: var(--navy-primary); border-bottom-color: var(--navy-primary); }

.tl-content { flex: 1; overflow-y: auto; padding: 2rem; display: none; flex-direction: column; gap: 1.5rem; }
.tl-content.active { display: flex; }

.empty-state { align-self: center; margin: auto; padding: 2rem; background: var(--bg-primary); border-radius: var(--radius-md); box-shadow: var(--shadow-subtle); color: var(--text-secondary); font-size: 0.9rem; }

.message-bubble-wrapper { display: flex; flex-direction: column; max-width: 70%; }
.message-bubble-wrapper.inbound { align-self: flex-start; }
.message-bubble-wrapper.outbound { align-self: flex-end; align-items: flex-end; }

.message-type-badge { font-size: 0.65rem; color: var(--text-secondary); margin-bottom: 0.3rem; margin-left: 0.5rem; margin-right: 0.5rem; font-weight: 600; letter-spacing: 0.05em; }

.message-bubble { padding: 0.8rem 1.1rem; border-radius: var(--radius-md); font-size: 0.95rem; line-height: 1.4; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }

.bubble-primary { background: var(--navy-primary); color: white; border-bottom-right-radius: 4px; }
.bubble-steel { background: white; border: 1px solid var(--border-light); color: var(--text-primary); border-bottom-left-radius: 4px; }

.message-time { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.4rem; margin-left: 0.5rem; margin-right: 0.5rem; }

.convo-composer { padding: 1.25rem 2rem; background: var(--bg-primary); border-top: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }

/* Dialer View */
.dialer-view { flex: 1; padding: 2.5rem; display: flex; flex-direction: column; align-items: flex-start; }
.dialer-wrap { width: 450px; padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.dialer-input { width: 100%; padding: 1rem; font-size: 1rem; border: 1px solid var(--steel-border); border-radius: var(--radius-md); outline: none; transition: border 0.2s; background: var(--bg-primary); font-family: inherit; }
.dialer-input:focus { border-color: var(--navy-primary); box-shadow: 0 0 0 3px rgba(10, 25, 47, 0.1); }
.status-text { font-size: 0.85rem; color: var(--text-secondary); min-height: 1.2rem; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding-top: 10vh; z-index: 999; }
.modal-overlay.hidden { display: none; }
.modal-box { background: var(--bg-primary); border-radius: var(--radius-md); width: 480px; box-shadow: var(--shadow-hover); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--border-light); }

.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border-light); }
.modal-header h3 { font-size: 1.1rem; margin: 0; }

.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.form-control { padding: 0.6rem 0.8rem; border: 1px solid var(--steel-border); border-radius: var(--radius-sm); font-size: 0.95rem; font-family: inherit; outline: none; transition: border 0.2s; }
.form-control:focus { border-color: var(--navy-primary); box-shadow: 0 0 0 2px rgba(10, 25, 47, 0.1); }

.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 0.8rem; background: var(--bg-secondary); }

/* Command Palette Custom */
.cmd-box { background: var(--bg-primary); border-radius: var(--radius-md); width: 550px; box-shadow: var(--shadow-hover); overflow: hidden; border: 1px solid var(--border-light); }
.cmd-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); }
.cmd-input-row span { font-size: 1.2rem; color: var(--text-secondary); font-weight: 600; }
.cmd-input { background: transparent; border: none; outline: none; font-size: 1.1rem; color: var(--text-primary); flex: 1; font-family: inherit; }
.cmd-input::placeholder { color: var(--text-secondary); }
.cmd-results { padding: 8px; max-height: 350px; overflow-y: auto; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.1s; }
.cmd-item:hover, .cmd-item.sel { background: var(--bg-tertiary); }
.cmd-item-icon { width: 32px; height: 32px; background: var(--bg-primary); border: 1px solid var(--border-light); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; flex-shrink: 0; box-shadow: var(--shadow-subtle); }
.cmd-item-text { font-size: 0.95rem; color: var(--text-secondary); }
.cmd-item-text strong { color: var(--navy-primary); font-weight: 500; }
.cmd-footer { padding: 10px 20px; border-top: 1px solid var(--border-light); display: flex; gap: 12px; background: var(--bg-secondary); font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }

.shortcut-hint { font-size: 0.75rem; color: var(--text-secondary); border: 1px solid var(--border-light); padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); background: var(--bg-secondary); margin-left: auto; letter-spacing: 0.05em; font-weight: 500; }
