/* SwiftCount Multi-Language Word Counter - Professional Styles */
/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans Arabic','Noto Sans CJK SC',sans-serif;
  line-height: 1.6;
  color: #333333;
  background-color: #ffffff;
  font-size: 16px;
  direction: ltr;
  transition: direction 0.3s ease;
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .header-content {
  flex-direction: row-reverse;
}

[dir="rtl"] .language-selector {
  order: -1;
}

[dir="rtl"] .button-group {
  flex-direction: row-reverse;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles */
.header {
  background-color: #ffffff;
  border-bottom: 1px solid #e9ecef;
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.logo h1 {
  color: #007BFF;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Professional Language Selector Styles */
.language-selector {
  position: relative;
  z-index: 1000;
}

.language-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  transition: all 0.3s ease;
  min-width: 140px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  position: relative;
}

.language-btn:hover {
  border-color: #007BFF;
  box-shadow: 0 4px 12px rgba(0,123,255,0.15);
  background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
  color: #007BFF;
}

.language-btn:active {
  transform: translateY(1px);
}

.current-flag {
  font-size: 18px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.current-lang {
  flex: 1;
  text-align: left;
}

.dropdown-arrow {
  font-size: 10px;
  margin-left: auto;
  transition: transform 0.3s ease;
  opacity: 0.7;
}

.language-btn.active .dropdown-arrow {
  transform: rotate(180deg);
  color: #007BFF;
}

/* Professional Dropdown Styles */
.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 320px;
  overflow-y: auto;
  backdrop-filter: blur(10px);
  border-top: 3px solid #007BFF;
}

.language-dropdown.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f8f9fa;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  position: relative;
}

.language-option:last-child {
  border-bottom: none;
  border-radius: 0 0 12px 12px;
}

.language-option:first-child {
  border-radius: 12px 12px 0 0;
}

.language-option:hover {
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  color: #007BFF;
  transform: translateX(4px);
}

.language-option.active {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: #1976d2;
  font-weight: 600;
}

.language-option.active::after {
  content: '✓';
  position: absolute;
  right: 16px;
  color: #007BFF;
  font-weight: bold;
}

.language-option .flag {
  font-size: 18px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
  transition: transform 0.2s ease;
}

.language-option:hover .flag {
  transform: scale(1.1);
}

/* Smooth scrollbar for dropdown */
.language-dropdown::-webkit-scrollbar {
  width: 6px;
}

.language-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 6px;
}

.language-dropdown::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 6px;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Ad Slot Styles */
.ad-slot {
  border: 2px dashed #dee2e6;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #6c757d;
  font-size: 12px;
  text-align: center;
  position: relative;
}

.ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.ad-dimensions {
  font-size: 10px;
  opacity: 0.7;
}

.ad-leaderboard {
  width: 728px;
  height: 90px;
  max-width: 100%;
}

.ad-skyscraper {
  width: 300px;
  height: 600px;
  margin-bottom: 30px;
}

.ad-in-content {
  width: 100%;
  height: 90px;
  margin: 20px 0;
}

/* Main Content Layout */
.main-content {
  padding: 40px 0;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}

.tool-section {
  width: 100%;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: #007BFF;
  box-shadow: 0 4px 12px rgba(0,123,255,0.15);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 10px;
  display: block;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: #007BFF;
  margin-bottom: 5px;
  transition: all 0.3s ease;
}

.stat-label {
  font-size: 13px;
  color: #6c757d;
  font-weight: 500;
  line-height: 1.4;
}

/* Input Section */
.input-section {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.input-header h3 {
  color: #333333;
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.language-indicator {
  background: #e3f2fd;
  color: #1976d2;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #bbdefb;
}

#textInput {
  width: 100%;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  min-height: 300px;
  font-family: inherit;
  transition: border-color 0.3s ease;
  direction: auto;
}

#textInput:focus {
  outline: none;
  border-color: #007BFF;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

#textInput::placeholder {
  color: #9ca3af;
  font-style: italic;
}

/* Button Styles */
.button-group {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background-color: #007BFF;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-info:hover {
  background-color: #138496;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23,162,184,0.3);
}

.btn-success {
  background-color: #28a745 !important;
}

.btn-success:hover {
  background-color: #218838 !important;
}

/* Sidebar Styles */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.custom-ad-section {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.custom-ad-section h3 {
  color: #333333;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 600;
}

.custom-ad {
  text-align: center;
}

.custom-ad-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 15px;
  transition: opacity 0.3s ease;
}

.custom-ad-image:hover {
  opacity: 0.9;
}

.custom-ad-text {
  font-size: 14px;
  color: #6c757d;
  line-height: 1.5;
}

/* Language Support Section */
.language-support-section {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.language-support-section h3 {
  color: #333333;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 600;
}

.language-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.language-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.language-item:hover {
  background: #e9ecef;
  transform: translateX(5px);
}

.flag {
  font-size: 20px;
}

/* Content Section */
.content-section {
  padding: 60px 0;
  background-color: #f8f9fa;
}

.content-section h2 {
  color: #333333;
  font-size: 32px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: 700;
}

.content-section p {
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 25px;
  color: #495057;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Footer Styles */
.footer {
  background-color: #333333;
  color: #ffffff;
  padding: 40px 0;
  text-align: center;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #007BFF;
}

.footer-text p {
  margin: 0;
  color: #adb5bd;
}

/* In-Content Ad Section */
.in-content-ad-section {
  background-color: #f8f9fa;
  padding: 30px 0;
  text-align: center;
}

/* Notification styles */
.notification {
  font-family: inherit;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .sidebar {
    order: 2;
  }
  
  .tool-section {
    order: 1;
  }
  
  .ad-skyscraper {
    width: 100%;
    height: 250px;
    max-width: 728px;
    margin: 0 auto 30px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .header-content {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .language-selector {
    order: -1;
  }
  
  .ad-leaderboard {
    width: 320px;
    height: 100px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2,1fr);
    gap: 15px;
  }
  
  .stat-card {
    padding: 15px;
  }
  
  .stat-number {
    font-size: 24px;
  }
  
  .input-section {
    padding: 20px;
  }
  
  .input-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .input-header h3 {
    font-size: 18px;
  }
  
  #textInput {
    padding: 15px;
    min-height: 250px;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .content-section h2 {
    font-size: 28px;
  }
  
  .content-section p {
    font-size: 16px;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-links {
    justify-content: center;
  }
  
  .ad-in-content {
    height: 100px;
  }
  
  /* Mobile language selector adjustments */
  .language-btn {
    min-width: 120px;
    font-size: 13px;
  }
  
  .language-dropdown {
    left: 50%;
    transform: translateX(-50%) translateY(-10px) scale(0.95);
    width: 200px;
  }
  
  .language-dropdown.show {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .logo h1 {
    font-size: 24px;
  }
  
  .ad-leaderboard {
    width: 300px;
    height: 100px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 15px;
  }
}

/* Animation classes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.3s ease-out;
}

/* Arabic font optimization */
[lang="ar"] {
  font-family: 'Noto Sans Arabic',Tahoma,Arial,sans-serif;
}

/* Chinese font optimization */
[lang="zh"] {
  font-family: 'Noto Sans CJK SC','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;
}

/* Loading animation for stat cards */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

.stat-card.loading .stat-number {
  animation: pulse 1s infinite;
}

/* Auto-detect direction for mixed content */
textarea[dir="auto"] {
  unicode-bidi: plaintext;
}

/* Overlay to close dropdown when clicking outside */
.dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: transparent;
  display: none;
}

.dropdown-overlay.show {
  display: block;
}