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

body {
  font-family: 'Sarabun', sans-serif;
  background-color: #f8f9fa;
  color: #333;
}

/* Layout */
.flex-col {
  display: flex;
  flex-direction: column;
}

.h-screen {
  height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Navigation Bar */
.navbar {
  background-color: #2c67be;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo i {
  font-size: 1.5rem;
}

.logo span {
  font-size: 1.25rem;
  font-weight: bold;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-greeting {
  display: none;
}

@media (min-width: 768px) {
  .user-greeting {
    display: inline-block;
  }
}

.notifications {
  position: relative;
}

.notification-count {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background-color: #ee4b2b;
  color: white;
  font-size: 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  width: 16rem;
  background-color: white;
  border-radius: 0.375rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 10;
  color: #333;
  font-size: 0.875rem;
}

.notifications:hover .notification-dropdown {
  display: block;
}

.notification-header {
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.notification-header p {
  font-weight: bold;
}

.notification-item {
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.notification-item:hover {
  background-color: #f3f4f6;
}

.notification-title {
  font-weight: 600;
}

.notification-desc {
  font-size: 0.75rem;
  color: #6b7280;
}

.user-avatar {
  background-color: #1d4ed8;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Main Content Layout */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  background-color: #1f2937;
  color: white;
  width: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .sidebar {
    width: 12rem;
  }
}

.sidebar-menu, .sidebar-footer {
  padding: 1rem;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.375rem;
  color: white;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background-color: #374151;
}

.menu-item.active {
  background-color: #2c67be;
}

.menu-item span {
  display: none;
}

@media (min-width: 768px) {
  .menu-item span {
    display: inline-block;
  }
}

/* Content Area */
.content {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Section Header */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h1 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: #6b7280;
}

/* Search Form */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .search-form {
    flex-direction: row;
    align-items: center;
  }
}

.search-input {
  position: relative;
  flex: 1;
}

.search-input input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
}

.search-input input:focus {
  outline: none;
  ring: 2px;
  ring-color: #2c67be;
}

.search-input i {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  color: #9ca3af;
}

select {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  width: 100%;
}

@media (min-width: 768px) {
  select {
    width: auto;
  }
}

/* Cards */
.card {
  background-color: white;
  padding: 1rem;
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.125rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

/* Product Cards */
.product-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .product-card {
    flex-direction: row;
  }
}

.product-card:hover {
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.product-image {
  width: 100%;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .product-image {
    width: 25%;
    margin-bottom: 0;
  }
}

.product-image img {
  width: 100%;
  border-radius: 0.375rem;
}

.product-details {
  width: 100%;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .product-details {
    width: 50%;
    padding: 0 1rem;
    margin-bottom: 0;
  }
}

.product-details h3 {
  font-size: 1.125rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.product-code {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.stock-status {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.in-stock {
  color: #059669;
  font-weight: bold;
}

.stock-count {
  color: #6b7280;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

.delivery-info {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.delivery-info span {
  font-weight: 600;
}

.document-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.document-link {
  color: #2c67be;
  text-decoration: none;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
}

.document-link:hover {
  text-decoration: underline;
}

.document-link i {
  margin-right: 0.25rem;
}

.product-action {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .product-action {
    width: 25%;
  }
}

.price {
  font-size: 1.25rem;
  font-weight: bold;
  color: #ee4b2b;
}

.original-price {
  font-size: 0.875rem;
  color: #6b7280;
  text-decoration: line-through;
}

.discount {
  font-size: 0.875rem;
  color: #059669;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
}

.data-table {
  min-width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  text-align: left;
}

.data-table thead {
  background-color: #f3f4f6;
}

.data-table tbody tr:hover {
  background-color: #ebf5ff;
}

/* Customer Info in Table */
.customer-info {
  display: flex;
  align-items: center;
}

.customer-avatar {
  background-color: #ebf5ff;
  color: #2c67be;
  font-weight: bold;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
}

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

.customer-phone {
  font-size: 0.75rem;
  color: #6b7280;
}

.time, .model {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Status Tags */
.status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-info {
  background-color: #ebf5ff;
  color: #2563eb;
}

.status-warning {
  background-color: #fff9db;
  color: #b45309;
}

.status-success {
  background-color: #ecfdf5;
  color: #047857;
}

/* Action Icons */
.action-icons {
  display: flex;
  gap: 0.25rem;
}

.action-btn {
  background-color: transparent;
  border: none;
  padding: 0.25rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.action-edit {
  background-color: #2c67be;
  color: white;
}

.action-call {
  background-color: #059669;
  color: white;
}

.action-doc {
  background-color: #b45309;
  color: white;
}

/* Pagination */
.pagination {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
}

.pagination-controls {
  display: flex;
  gap: 0.25rem;
}

.pagination-btn {
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  padding: 0.25rem 0.75rem;
  color: #6b7280;
  background-color: transparent;
  cursor: pointer;
}

.pagination-btn:hover {
  background-color: #f3f4f6;
}

.pagination-btn.active {
  background-color: #2c67be;
  color: white;
  border-color: #2c67be;
}

/* Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .stats-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background-color: white;
  padding: 1rem;
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card h3 {
  font-size: 1.125rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #2c67be;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: bold;
}

.stat-period {
  font-size: 0.875rem;
  color: #6b7280;
}

.stat-change {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
}

.stat-change i {
  margin-right: 0.25rem;
}

.positive {
  color: #059669;
}

.negative {
  color: #ee4b2b;
}

/* Pipeline */
.pipeline-container {
  overflow-x: auto;
}

.pipeline-stages {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  min-width: max-content;
  padding-bottom: 1rem;
}

.pipeline-stage {
  background-color: #f3f4f6;
  padding: 0.5rem;
  border-radius: 0.375rem;
}

.pipeline-stage h4 {
  font-weight: bold;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.stage-count {
  text-align: center;
  color: white;
  border-radius: 0.25rem;
  padding: 0.25rem 0;
  margin-bottom: 0.5rem;
}

.info {
  background-color: #2c67be;
}

.warning {
  background-color: #f59e0b;
}

.success {
  background-color: #059669;
}

.purple {
  background-color: #7c3aed;
}

.stage-count span {
  font-size: 1.125rem;
  font-weight: bold;
}

.stage-item {
  background-color: white;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.item-title {
  font-weight: 500;
}

.item-desc {
  font-size: 0.75rem;
  color: #6b7280;
}

.item-date {
  font-size: 0.75rem;
  color: #6b7280;
}

.show-more {
  text-align: center;
  font-size: 0.75rem;
  color: #2c67be;
  cursor: pointer;
}

.show-more:hover {
  text-decoration: underline;
}

/* Product Brief in Table */
.product-brief {
  display: flex;
  align-items: center;
}

.product-thumbnail {
  width: 2rem;
  height: 2rem;
  background-color: #f3f4f6;
  border-radius: 0.25rem;
  margin-right: 0.5rem;
}

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

.font-medium {
  font-weight: 500;
}

/* Document Grid */
.document-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .document-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .document-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.document-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 1rem;
  transition: box-shadow 0.2s;
}

.document-card:hover {
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.document-icon {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.pdf-icon {
  background-color: #fee2e2;
  color: #ef4444;
  width: 3rem;
  height: 3rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
}

.pdf-icon i {
  font-size: 1.5rem;
}

.document-card h3 {
  font-size: 0.875rem;
  font-weight: bold;
}

.document-card p {
  font-size: 0.75rem;
  color: #6b7280;
}

.document-card .document-type {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

.document-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Document Types */
.doc-type-spec {
  background-color: #ebf5ff;
  color: #2563eb;
}

.doc-type-manual {
  background-color: #ecfdf5;
  color: #047857;
}

.doc-type-compare {
  background-color: #fff9db;
  color: #b45309;
}

/* Buttons */
.btn {
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn i {
  margin-right: 0.25rem;
}

.btn-primary {
  background-color: #2c67be;
  color: white;
}

.btn-primary:hover {
  background-color: #1e4b9a;
}

.btn-success {
  background-color: #059669;
  color: white;
}

.btn-success:hover {
  background-color: #047857;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid #2c67be;
  color: #2c67be;
}

.btn-outline:hover {
  background-color: #ebf5ff;
}

.btn-link {
  background: none;
  border: none;
  color: #2c67be;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.load-more, .text-center {
  text-align: center;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 42rem;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  background-color: #2c67be;
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: bold;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.25rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  background-color: #f3f4f6;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.checkbox-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
}

textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem;
  resize: vertical;
}

.share-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.share-method {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  color: white;
  cursor: pointer;
}

.share-method i {
  margin-right: 0.5rem;
}

.share-line {
  background-color: #06c755;
}

.share-email {
  background-color: #2c67be;
}

.share-sms {
  background-color: #f59e0b;
}

.share-qr {
  background-color: #6b7280;
}

/* Document Preview */
.document-preview {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.preview-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.preview-thumbnail {
  width: 4rem;
  height: 3rem;
  background-color: #f3f4f6;
  border-radius: 0.25rem;
  margin-right: 1rem;
}

/* Mobile Specific Styles */
@media (max-width: 767px) {
  .sidebar {
    width: 4rem;
  }
  
  .menu-item span {
    display: none;
  }
  
  .user-greeting {
    display: none;
  }
  
  .search-form {
    flex-direction: column;
  }
  
  .product-card {
    flex-direction: column;
  }
  
  .product-image, .product-details, .product-action {
    width: 100%;
    margin-bottom: 1rem;
  }
}