/* Sterling Resolve Brand Styles */
:root {
  --sr-primary: #0052cc;      /* Sterling blue */
  --sr-accent: #f7ab36;       /* Warm accent */
  --sr-dark: #0f172a;         /* Dark navy */
  --sr-light: #f8fafc;        /* Light background */
  --sr-success: #10b981;      /* Success green */
  --sr-error: #ef4444;        /* Error red */
  --sr-warning: #f59e0b;      /* Warning orange */
}

/* Font Loading */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter.var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

/* Base Typography */
html {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--sr-primary);
  outline-offset: 2px;
}

/* Custom Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Loading Spinner */
.spinner {
  border: 2px solid rgba(0, 82, 204, 0.1);
  border-top-color: var(--sr-primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Custom Button Styles */
.btn-primary {
  background-color: var(--sr-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: var(--sr-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.2);
}

/* Form Styles */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  transition: all 0.2s;
  background-color: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--sr-primary);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

/* Card Styles */
.card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Dashboard Card Backgrounds */
.card-documents {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6)), url('/assets/documents-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.card-messages {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6)), url('/assets/messages-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.card-resources {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6)), url('/assets/messages-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.card-upload {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6)), url('/assets/upload-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.card-coaching {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6)), url('/assets/coaching-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Enhanced hover effects for background cards */
.card-documents:hover,
.card-messages:hover,
.card-resources:hover,
.card-upload:hover,
.card-coaching:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.7)), url('/assets/documents-bg.jpg');
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.card-messages:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.7)), url('/assets/messages-bg.jpg');
}

.card-resources:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.7)), url('/assets/messages-bg.jpg');
}

.card-upload:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.7)), url('/assets/upload-bg.jpg');
}

.card-coaching:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.7)), url('/assets/coaching-bg.jpg');
}

/* Alert Styles */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Resources (Netflix-style) */
#resources-page {
  --sr-row-gap: 1rem;
}

#resources-page .sr-row {}

#resources-page .sr-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(50% - 0.75rem);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
  #resources-page .sr-track {
    grid-auto-columns: calc(33.333% - 0.75rem);
  }
}

@media (min-width: 1024px) {
  #resources-page .sr-track {
    grid-auto-columns: calc(20% - 0.8rem);
  }
}

#resources-page .sr-track::-webkit-scrollbar { height: 8px; }
#resources-page .sr-track::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 9999px; }
#resources-page .sr-track::-webkit-scrollbar-track { background: transparent; }

#resources-page .sr-tile {
  position: relative;
  display: block;
  border-radius: 0.75rem;
  overflow: hidden;
  scroll-snap-align: start;
  background: #111;
  transform: translateZ(0);
}

#resources-page .sr-tile img {
  width: 100%;
  height: 9rem;
  object-fit: cover;
  display: block;
}

@media (min-width: 640px) {
  #resources-page .sr-tile img { height: 12rem; }
}
@media (min-width: 1024px) {
  #resources-page .sr-tile img { height: 10.5rem; }
}

#resources-page .sr-tile:hover { z-index: 2; }

#resources-page .sr-tile .sr-tile-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: end;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 75%);
  transition: transform 180ms ease, background 180ms ease;
}

#resources-page .sr-tile:hover .sr-tile-overlay {
  transform: scale(1.03);
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.75) 80%);
}

#resources-page .sr-tile .sr-tile-meta {
  padding: 0.6rem 0.7rem;
}

#resources-page .sr-tile .sr-tile-title {
  font-weight: 700;
  font-size: 0.95rem;
}

#resources-page .sr-tile .sr-tile-sub {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
}

#resources-page .sr-play {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.9);
  color: #000;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

#resources-page .sr-play svg { width: 18px; height: 18px; }

#resources-page .sr-arrow {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.2);
  transition: background 160ms ease, transform 160ms ease;
}

#resources-page .sr-arrow:hover { background: rgba(255,255,255,0.25); transform: translateY(-1px); }

/* Dashboard Navigation */
.nav-item {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #6b7280;
}

.nav-item:hover {
  background-color: #f3f4f6;
  color: var(--sr-primary);
}

.nav-item.active {
  background-color: var(--sr-primary);
  color: white;
}

/* Modern Chat Styles */
.chat-container {
  height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  padding: 1rem;
  scroll-behavior: smooth;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

/* Attorney dashboard chat container should fill available space */
.attorney-chat .chat-container {
  height: auto;
  flex: 1;
  min-height: 0;
  max-height: 100%;
}

/* Ensure attorney dashboard layout doesn't overflow */
.attorney-chat {
  min-height: 0;
  overflow: hidden;
}

.chat-container.loaded {
  opacity: 1;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.chat-messages-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 75%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  animation: messageSlideIn 0.3s ease-out;
  overflow: hidden;
}

.chat-bubble.user {
  align-self: flex-end;
  position: relative;
}

.chat-bubble.user::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 0.75rem;
  border-left: 6px solid var(--sr-primary);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.chat-bubble.attorney {
  align-self: flex-start;
  position: relative;
}

.chat-bubble.attorney::before {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 0.75rem;
  border-right: 6px solid #e2e8f0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.message-content {
  padding: 0.875rem 1.125rem;
  border-radius: 1.25rem;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.chat-bubble.user .message-content {
  background: linear-gradient(135deg, var(--sr-primary) 0%, #0066ff 100%);
  color: white;
  border-bottom-right-radius: 0.375rem;
}

.chat-bubble.attorney .message-content {
  background: white;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 0.375rem;
}

.message-content p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.9rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Ensure all text content in message bubbles wraps properly */
.message-content * {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* File attachment styles */
.file-attachment {
  max-width: 100%;
}

.image-attachment img {
  max-width: 250px;
  max-height: 200px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.image-attachment img:hover {
  transform: scale(1.02);
}

.document-attachment {
  min-width: 200px;
  max-width: 300px;
  transition: all 0.2s ease;
}

.document-attachment:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-bubble.attorney .document-attachment {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
}

.chat-bubble.attorney .document-attachment a {
  color: var(--sr-primary) !important;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

.chat-bubble.user .message-meta {
  justify-content: flex-end;
  color: #64748b;
}

.chat-bubble.attorney .message-meta {
  justify-content: flex-start;
  color: #64748b;
}

.sender-name {
  font-weight: 500;
}

.message-time {
  color: #94a3b8;
}

.message-status {
  display: flex;
  align-items: center;
}

/* Chat Input Styles */
.chat-input-container {
  padding: 1rem 1.5rem;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.chat-form {
  display: flex;
  align-items: center;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1.5rem;
  padding: 0.5rem;
  gap: 0.5rem;
  flex: 1;
  transition: all 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--sr-primary);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
  background: white;
}

.attachment-btn,
.emoji-btn,
.format-btn {
  padding: 0.5rem;
  color: #64748b;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
}

.attachment-btn:hover,
.emoji-btn:hover,
.format-btn:hover {
  background: #e2e8f0;
  color: var(--sr-primary);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  outline: none;
  color: #1e293b;
  resize: none;
  min-height: 20px;
  max-height: 120px;
  line-height: 1.4;
  font-family: inherit;
  overflow-y: auto;
  transition: height 0.1s ease;
}

.chat-input[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

.chat-input::placeholder {
  color: #94a3b8;
}

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

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

.chat-input::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.chat-input::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.send-btn {
  background: var(--sr-primary);
  color: white;
  border: none;
  border-radius: 0.75rem;
  padding: 0.625rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover {
  background: var(--sr-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.3);
}

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

/* Typing Indicator */
.typing-indicator {
  background: #f8fafc;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dots span {
  width: 0.375rem;
  height: 0.375rem;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

/* Animations */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Progress Bar */
.progress-bar {
  height: 0.5rem;
  background-color: #e2e8f0;
  border-radius: 0.25rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--sr-primary);
  transition: width 0.3s ease;
}

/* Utility Classes */
.text-primary { color: var(--sr-primary); }
.text-accent { color: var(--sr-accent); }
.bg-primary { background-color: var(--sr-primary); }
.bg-accent { background-color: var(--sr-accent); }
.border-primary { border-color: var(--sr-primary); }

/* Mobile Menu Toggle */
@media (max-width: 768px) {
  .mobile-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-menu.active {
    display: block;
  }

  /* Mobile Chat Optimizations */
  .chat-container {
    height: 350px;
  }

  .chat-bubble {
    max-width: 85%;
  }

  .message-content {
    padding: 0.75rem 1rem;
  }

  .chat-input-container {
    padding: 0.75rem 1rem;
  }

  .input-wrapper {
    padding: 0.375rem;
  }

  .attachment-btn,
  .emoji-btn,
  .format-btn {
    padding: 0.375rem;
  }

  .send-btn {
    padding: 0.5rem;
  }
}

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

.font-serif-display {
  font-family: "Cinzel", "Trajan Pro", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

/* Focus ring for buttons */
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.4);
}

/* Card shadows */
.shadow-card { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.shadow-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* Rounded */
.card, .chat-bubble, .chat-container, .btn-primary { border-radius: 0.75rem; }

/* Skeleton */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
.skeleton { animation: pulse 1.5s infinite ease-in-out; background: #e2e8f0; } 

/* Video Modal Styles */
#video-modal {
  transition: opacity 0.3s ease-in-out;
}

#video-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

#video-modal:not(.hidden) {
  opacity: 1;
}

#video-iframe {
  border-radius: 0.5rem;
}
