/* Word Counter Styles */

body, html {
  cursor: default;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure proper cursor behavior */
* {
  cursor: inherit;
}

input, textarea, button, select {
  cursor: pointer;
}

input:focus, textarea:focus {
  cursor: text;
}

/* Global box-sizing fix */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Counter-specific variables */
:root {
  --counter-primary: #00bfff;
  --counter-secondary: #ffd700;
  --counter-accent: #ff6b6b;
  --counter-success: #51cf66;
  --counter-warning: #ffd43b;
  --counter-danger: #ff6b6b;
  --counter-info: #74c0fc;
  
  --stat-shadow: 0 8px 32px rgba(0, 191, 255, 0.15);
  --card-hover: 0 12px 40px rgba(0, 191, 255, 0.25);
}

/* Main container */
.counter-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  box-sizing: border-box;
  width: 100%;
}

/* Input Section */
.input-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--stat-shadow);
}

.textarea-container {
  position: relative;
}

#text-input {
  width: 100%;
  min-height: 300px;
  max-height: 600px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem;
  color: #ffffff;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.3s ease;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 191, 255, 0.5) rgba(255, 255, 255, 0.1);
}

#text-input:focus {
  outline: none;
  border-color: var(--counter-primary);
  box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
}

/* Custom scrollbar for text input */
#text-input::-webkit-scrollbar {
  width: 8px;
}

#text-input::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

#text-input::-webkit-scrollbar-thumb {
  background: rgba(0, 191, 255, 0.5);
  border-radius: 4px;
  transition: background 0.3s ease;
}

#text-input::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 191, 255, 0.7);
}

#text-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.textarea-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #ffffff;
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.action-btn.clear:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: var(--counter-danger);
}

.action-btn.copy:hover {
  background: rgba(81, 207, 102, 0.2);
  border-color: var(--counter-success);
}

.action-btn.paste:hover {
  background: rgba(116, 192, 252, 0.2);
  border-color: var(--counter-info);
}

.btn-icon {
  font-size: 1.1rem;
}

/* Stats Section */
.stats-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--stat-shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
  transition: height 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover);
}

.stat-card:hover::before {
  height: 5px;
}

.stat-card.primary {
  --accent-color: var(--counter-primary);
}

.stat-card.secondary {
  --accent-color: var(--counter-secondary);
}

.stat-card.tertiary {
  --accent-color: var(--counter-accent);
}

.stat-card.quaternary {
  --accent-color: var(--counter-success);
}

.stat-card.reading {
  --accent-color: var(--counter-warning);
}

.stat-card.speaking {
  --accent-color: var(--counter-info);
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.8;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Analysis Section */
.analysis-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--stat-shadow);
}

.analysis-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
}

.tab-btn {
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Quicksand', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--counter-primary);
  border-bottom-color: var(--counter-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Social Media Cards */
.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.social-card {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.social-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.social-card.twitter {
  border-left: 4px solid #1da1f2;
}

.social-card.facebook {
  border-left: 4px solid #1877f2;
}

.social-card.instagram {
  border-left: 4px solid #e4405f;
}

.social-card.linkedin {
  border-left: 4px solid #0077b5;
}

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

.social-icon {
  font-size: 1.5rem;
}

.social-name {
  font-weight: 600;
  color: #ffffff;
}

.social-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.social-count {
  font-size: 1.1rem;
  font-weight: 500;
  color: #ffffff;
}

.social-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.social-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--counter-success), var(--counter-warning), var(--counter-danger));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Detailed Analysis */
.detailed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.detail-card {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.detail-card h4 {
  margin: 0 0 1.5rem 0;
  color: var(--counter-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.detail-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.detail-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.detail-value {
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
}

.quality-metrics {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metric-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
}

.metric-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--counter-danger), var(--counter-warning), var(--counter-success));
  border-radius: 5px;
  transition: width 0.5s ease;
  width: 0%;
}

.metric-value {
  color: #ffffff;
  font-weight: 600;
  text-align: right;
}

/* Keywords Section */
.keywords-container {
  width: 100%;
}

.keywords-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.keywords-header h4 {
  margin: 0;
  color: var(--counter-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.keywords-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.keywords-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  cursor: pointer;
}

.keywords-controls input[type="checkbox"] {
  accent-color: var(--counter-primary);
}

.keywords-controls select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.5rem;
  color: #ffffff;
  font-family: 'Quicksand', sans-serif;
}

.keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-height: 100px;
}

.keyword-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: #ffffff;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.keyword-item:hover {
  background: rgba(0, 191, 255, 0.2);
  border-color: var(--counter-primary);
  transform: scale(1.05);
}

.keyword-text {
  font-weight: 500;
}

.keyword-count {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--counter-primary);
}

.no-keywords {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
  .counter-container {
    padding: 1rem;
    gap: 1.5rem;
    margin: 0;
    max-width: 100vw;
  }

  .input-section,
  .stats-section,
  .analysis-section {
    padding: 1.5rem;
    margin: 0;
    width: 100%;
  }

  #text-input {
    min-height: 250px;
    font-size: 0.95rem;
    padding: 1rem;
    width: calc(100% - 2rem);
    margin: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
  }

  .stat-card {
    padding: 1rem;
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .social-grid {
    grid-template-columns: 1fr;
  }

  .detailed-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .textarea-actions {
    justify-content: center;
  }

  .action-btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  .keywords-header {
    flex-direction: column;
    align-items: stretch;
  }

  .keywords-controls {
    justify-content: space-between;
  }

  .analysis-tabs {
    justify-content: center;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .counter-container {
    padding: 0.5rem;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .input-section,
  .stats-section,
  .analysis-section {
    padding: 1rem;
    margin: 0;
  }

  #text-input {
    padding: 0.75rem;
    min-height: 200px;
    width: calc(100% - 1.5rem);
  }

  .stat-card {
    padding: 0.75rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .stat-icon {
    font-size: 1.5rem;
  }

  .textarea-actions {
    flex-direction: column;
  }

  .action-btn {
    min-width: auto;
    width: 100%;
    justify-content: center;
  }
}