/**
 * Legal Tool Module Stylesheet
 * Custom CSS for Flatsome Child Theme matching mockup layout
 */

:root {
  --lt-primary: #2563eb;
  --lt-primary-hover: #1d4ed8;
  --lt-text-dark: #1e3a8a;
  --lt-text-body: #334155;
  --lt-border-active: #2563eb;
  --lt-bg-container: #eff6ff;
  /* light blue background */
  --lt-shadow-sm:
    0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --lt-shadow-md:
    0 10px 15px -3px rgba(37, 99, 235, 0.1),
    0 4px 6px -2px rgba(37, 99, 235, 0.05);
  --lt-shadow-xl:
    0 20px 25px -5px rgba(15, 23, 42, 0.15),
    0 10px 10px -5px rgba(15, 23, 42, 0.1);
  --lt-radius: 20px;
  --lt-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main title */
.legal-tool-main-title {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--lt-text-dark);
  text-transform: uppercase;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

/* Wrapper container */
.legal-tool-wrapper {
  background: var(--lt-bg-container);
  border-radius: var(--lt-radius);
  padding: 40px 30px;
  margin: 30px auto;
  font-family: inherit;
}

/* Tabs list */
.legal-tool-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

/* Individual card tab */
.legal-tool-tab-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 240px;
  height: 155px;
  padding: 20px;
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: 16px;
  box-shadow: var(--lt-shadow-sm);
  cursor: pointer;
  transition: var(--lt-transition);
  position: relative;
  outline: none;
  text-align: center;
}

.legal-tool-tab-card:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.legal-tool-tab-card.active {
  border-color: var(--lt-border-active);
  background: #ffffff;
  box-shadow: var(--lt-shadow-md);
}

.legal-tool-tab-card.disabled {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
}

.legal-tool-tab-card .legal-tool-card-icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 12px;
}

.legal-tool-tab-card .legal-tool-card-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.35;
  text-transform: none;
}

/* Caret badge on Bản đồ rủi ro */
.legal-tool-tab-card .card-badge {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 12px;
  font-weight: bold;
  color: var(--lt-primary);
}

/* Panels styling */
.legal-tool-panels {
  position: relative;
  min-height: 180px;
}

.legal-tool-panel {
  display: none;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
}

.legal-tool-panel.active {
  display: block;
  animation: ltPanelFadeIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes ltPanelFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Tab Switching Loader */
.legal-tool-tab-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border-radius: 12px;
}

.legal-tool-tab-loader.show {
  opacity: 1;
  pointer-events: auto;
}

.lt-tab-spinner {
  width: 40px;
  height: 40px;
  border: 3.5px solid rgba(37, 99, 235, 0.1);
  border-top-color: var(--lt-primary);
  border-radius: 50%;
  animation: lt-spin 0.65s linear infinite;
}

/* 2-column grid layout for questions list */
.legal-tool-questions-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin-bottom: 30px;
  padding: 0 10px;
}

/* Question radio item */
.legal-tool-question-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  position: relative;
  user-select: none;
  margin-bottom: 0;
  padding: 6px 10px;
  border-radius: 8px;
  transition: var(--lt-transition);
}

.legal-tool-question-item:hover {
  background: rgba(255, 255, 255, 0.4);
}

.legal-tool-question-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

/* Custom circular radio button style */
.legal-tool-question-item .custom-radio {
  height: 18px;
  width: 18px;
  background-color: #ffffff;
  border: 2px solid #a1a1aa;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  position: relative;
  margin-top: 3px;
  transition: var(--lt-transition);
}

.legal-tool-question-item:hover .custom-radio {
  border-color: #71717a;
}

.legal-tool-question-item input[type="radio"]:checked ~ .custom-radio {
  border-color: var(--lt-primary);
}

.legal-tool-question-item .custom-radio::after {
  content: "";
  position: absolute;
  display: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lt-primary);
}

.legal-tool-question-item input[type="radio"]:checked ~ .custom-radio::after {
  display: block;
}

/* Text label */
.legal-tool-question-item .question-text {
  font-size: 16px;
  color: #334155;
  line-height: 1.45;
  font-weight: 500;
}

.legal-tool-question-item input[type="radio"]:checked ~ .question-text {
  color: #0f172a;
}

/* Center submit action button */
.legal-tool-action-bar {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.legal-tool-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  background: #004aad !important;
  color: #ffffff !important;
  border: none !important;
  padding: 8px 36px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: var(--lt-transition);
  box-shadow:
    0 4px 6px -1px rgba(37, 99, 235, 0.2),
    0 2px 4px -1px rgba(37, 99, 235, 0.1);
  outline: none;
}

.legal-tool-submit-btn:hover {
  background: var(--lt-primary-hover) !important;
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.legal-tool-submit-btn:active {
  transform: translateY(1px);
}

/* Loading button logic */
.legal-tool-submit-btn.loading {
  opacity: 0.8;
  cursor: not-allowed;
  pointer-events: none;
}

.legal-tool-submit-btn.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: lt-spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

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

.legal-tool-no-data {
  text-align: center;
  padding: 30px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: var(--lt-text-muted);
  font-style: italic;
  margin: 0;
}

/* Modal Popup Overlay */
.legal-tool-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.legal-tool-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Box Container */
.legal-tool-modal-box {
  background: #ffffff;
  width: 100%;
  max-width: 750px;
  border-radius: 16px;
  box-shadow: var(--lt-shadow-xl);
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 82vh;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.legal-tool-modal-overlay.open .legal-tool-modal-box {
  transform: scale(1);
}

/* Modal Close Button */
.legal-tool-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: #f1f5f9;
  border: none !important;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--lt-text-muted);
  transition: var(--lt-transition);
  padding: 0;
  outline: none;
  z-index: 10;
}

.legal-tool-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

/* Modal Header */
.legal-tool-modal-header {
  padding: 24px 60px 18px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.legal-tool-modal-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--lt-text-dark);
  margin: 0;
  line-height: 1.4;
}

/* Modal Body */
.legal-tool-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Scrollbar for Modal Body */
.legal-tool-modal-body::-webkit-scrollbar {
  width: 6px;
}

.legal-tool-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.legal-tool-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.legal-tool-modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal Content Rich Text */
.legal-tool-modal-content {
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
}

.legal-tool-modal-content p:last-child {
  margin-bottom: 0;
}

/* Modal Footer */
.legal-tool-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  background: #f8fafc;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.legal-tool-modal-btn-close {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 8px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--lt-transition);
  outline: none;
}

.legal-tool-modal-btn-close:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Prevent body scrolling when active */
body.legal-tool-modal-open {
  overflow: hidden !important;
}

/* Responsive breakpoint */
@media (max-width: 768px) {
  .legal-tool-questions-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .legal-tool-tabs {
    gap: 16px;
  }

  .legal-tool-tab-card {
    width: 100%;
    max-width: 280px;
    height: 140px;
  }

  .legal-tool-wrapper {
    padding: 20px 10px;
  }
}

/* ==========================================================================
   Legal Consult Posts Sidebar Layout
   ========================================================================== */
.legal-consult-posts-widget {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin-bottom: 30px;
  border: 1px solid #e2e8f0;
}

.legal-consult-posts-widget .widget-title-box {
  background: var(--cl-linear);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  padding: 12px 20px;
  margin: 0;
}

.legal-consult-posts-widget .posts-list-container {
  padding: 15px;
}

.legal-consult-posts-widget .post-item-row {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}

.legal-consult-posts-widget .post-item-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.legal-consult-posts-widget .post-item-row:first-child {
  padding-top: 0;
}

.legal-consult-posts-widget .post-item-thumb {
  width: 110px;
  height: 75px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f5f9;
}

.legal-consult-posts-widget .post-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.legal-consult-posts-widget .post-item-info {
  flex-grow: 1;
}

.legal-consult-posts-widget .post-item-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 6px 0;
}

.legal-consult-posts-widget .post-item-title a {
  color: #1e293b;
  text-decoration: none;
  transition: color 0.2s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.legal-consult-posts-widget .post-item-title a:hover {
  color: #1d6fa4;
}

.legal-consult-posts-widget .post-item-date {
  font-size: 13px;
  font-style: italic;
  color: #64748b;
  margin: 0;
}
