/* Base styles */
:root {
  --grum-primary: #4f29a1;
  --grum-primary-light: rgba(79, 41, 161, 0.1);
  --grum-primary-dark: #3b1c7e;
  --grum-button-hover: #f77737;
  --grum-shadow: rgba(79, 41, 161, 0.4);
  --grum-white: #ffffff;
  --grum-light-gray: #f5f5f5;
  --grum-gray: #e0e0e0;
  --grum-dark-gray: #606060;
  --grum-black: #303030;
  --grum-red: #dc3545;
  --grum-green: #27ae60;
  --grum-yellow: #f1c40f;
  --grum-blue: #3498db;
  --grum-transition: all 0.3s ease;
  --grum-border-radius: 12px;
  --grum-card-shadow: 0 10px 20px rgba(79, 41, 161, 0.1);
}

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

/* Base Selection Styles */
::selection {
  background-color: rgba(79, 41, 161, 0.2);
  color: var(--grum-primary);
}

::-moz-selection {
  background-color: rgba(79, 41, 161, 0.2);
  color: var(--grum-primary);
}

/* App container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 20px;
}

.header h1 {
  color: var(--grum-light-gray);
  font-size: 25px;
  margin-bottom: 5px;
  font-weight: 700;
}

.subtitle {
  color: var(--grum-light-gray);
  font-size: 11px;
}

/* Main content */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
}

/* Card styles */
.card {
  background: var(--grum-white);
  border-radius: var(--grum-border-radius);
  box-shadow: var(--grum-card-shadow);
  padding: 20px;
  height: 100%;
  transition: var(--grum-transition);
}

/* Controls */
.controls-section {
  max-height: 600px;
}

.results-card {
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.section-title {
  color: var(--grum-primary);
  font-size: 24px;
  font-weight: 600;
  text-align: left !important;
  margin-bottom: 15px;
}

/* Input styles */
.input-group {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
}

.input-icon {
  position: absolute;
  left: 10px;
  top: 10px;
  color: var(--grum-primary);
  font-size: 19px;
}

.input-group .input-field {
  flex: 1;
  padding: 10px 16px 10px 44px;
  border: 2px solid var(--grum-gray) !important;
  border-radius: var(--grum-border-radius) !important;
  font-size: 16px;
  transition: var(--grum-transition);
}

.input-group .input-field:focus {
  outline: none;
  border-color: var(--grum-primary) !important;
  box-shadow: 0 0 0 3px var(--grum-primary-light);
}

.helper-text {
  color: var(--grum-dark-gray);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Button styles */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--grum-primary);
  color: var(--grum-white);
  border: none;
  border-radius: var(--grum-border-radius);
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--grum-transition);
  margin-left: 10px;
}

.btn-primary:hover {
  background-color: var(--grum-button-hover);
  transform: translateY(-2px);
}

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

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-text {
  margin-right: 5px;
}

/* Info box */
.info-box {
  background-color: var(--grum-primary-light);
  border-radius: var(--grum-border-radius);
  padding: 15px;
  display: flex;
  align-items: flex-start;
}

.info-icon {
  color: var(--grum-primary);
  font-size: 15px;
  margin-right: 10px;
  flex-shrink: 0;
}

.info-content h3 {
  color: var(--grum-primary);
  margin-bottom: 5px;
  font-size: 17px;
}

.info-content p {
  color: var(--grum-dark-gray);
  font-size: 15px;
}

/* Results section */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.status-indicator {
  background-color: var(--grum-primary-light);
  color: var(--grum-primary);
  padding: 5px 10px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 500;
}

.results-content {
  flex: 1;
  position: relative;
}

/* Placeholder content */
.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  text-align: center;
  padding: 20px;
  transition: var(--grum-transition);
}

.placeholder-icon {
  font-size: 40px;
  color: var(--grum-gray);
  margin-bottom: 15px;
}

.placeholder-text {
  color: var(--grum-dark-gray);
  max-width: 70%;
  font-size: 12px;
}

/* Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 10;
}

.loader {
  width: 50px;
  height: 50px;
  border: 5px solid var(--grum-primary-light);
  border-top: 5px solid var(--grum-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.loader-text {
  color: var(--grum-primary);
  font-weight: 500;
  font-size: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Error container */
.error-container {
  display: flex;
  align-items: flex-start;
  background-color: rgba(220, 53, 69, 0.1);
  border-radius: var(--grum-border-radius);
  padding: 15px;
  margin-bottom: 15px;
}

.error-icon {
  color: var(--grum-red);
  font-size: 15px;
  margin-right: 10px;
  flex-shrink: 0;
}

.error-title {
  color: var(--grum-red);
  margin-bottom: 5px;
  font-size: 11px;
}

.error-message {
  color: var(--grum-dark-gray);
  font-size: 9.5px;
}

/* Results container */
.results-container {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Profile section */
.profile-section {
  margin-bottom: 20px;
}

.profile-info {
  display: flex;
  align-items: center;
  background-color: var(--grum-light-gray);
  border-radius: var(--grum-border-radius);
  padding: 15px;
}

.ig-profile-image {
  width: 80px !important;
  height: 80px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  margin-right: 15px !important;
  border: 3px solid var(--grum-primary) !important;
}

.profile-details {
  flex: 1;
}

.profile-username {
  font-size: 24px;
  text-align: left !important;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--grum-primary);
}

.profile-stats {
  display: flex;
  gap: 15px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-weight: 600;
  font-size: 19px;
  color: var(--grum-black);
}

.stat-label {
  font-size: 14px;
  color: var(--grum-dark-gray);
}

/* Analytics section */
.analytics-section {
  margin-bottom: 20px;
}

.analytics-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.analytics-card {
  background-color: var(--grum-light-gray);
  border-radius: var(--grum-border-radius);
  padding: 15px;
  display: flex;
  align-items: center;
}

.analytics-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 24px;
}

.engagement-icon {
  background-color: rgba(52, 152, 219, 0.1);
  color: var(--grum-blue);
}

.shadowban-icon {
  background-color: rgba(241, 196, 15, 0.1);
  color: var(--grum-yellow);
}

.analytics-content {
  flex: 1;
}

.analytics-value {
  font-size: 18px;
  font-weight: 600;
  text-align: left;
}

.analytics-label {
  font-size: 14px;
  color: var(--grum-dark-gray);
  text-align: left;
}

/* Risk ratings */
.risk-low {
  color: var(--grum-green);
}

.risk-medium {
  color: var(--grum-yellow);
}

.risk-high {
  color: var(--grum-red);
}

.engagement-high {
  color: var(--grum-green);
}

.engagement-medium {
  color: var(--grum-yellow);
}

.engagement-low {
  color: var(--grum-red);
}

/* Posts section */
.subsection-title {
  margin: 50px 0 20px;
  font-size: 19px;
  text-align: left;
  color: var(--grum-primary);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.post-item {
  position: relative;
  border-radius: var(--grum-border-radius);
  overflow: hidden;
  padding-bottom: 100%; /* Make square */
  background-size: cover;
  background-position: center;
  transition: var(--grum-transition);
}

.post-item:hover {
  transform: scale(1.05);
}

.post-item:hover .post-overlay {
  opacity: 0.1;
}

.post-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* opacity: 0; */
  transition: var(--grum-transition);
  cursor: pointer;
}

.post-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.post-stat {
  color: var(--grum-white);
  margin: 2.5px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.post-stat i {
  margin-right: 5px;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 30px;
  color: var(--grum-light-gray);
  font-size: 15px;
}

/* Helper classes */
.hidden {
  display: none !important;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--grum-black);
  color: var(--grum-white);
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 8.5px;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .app-container {
    padding: 16px;
  }

  .header h1 {
    font-size: 32px;
  }
}

@media (max-width: 768px) {
  .input-group {
    flex-direction: column;
  }

  .input-group .input-field {
    width: 100%;
    margin-bottom: 16px;
    padding: 12px 0 12px 30px;
  }

  .btn-primary {
    width: 100%;
    margin-left: 0;
  }

  .analytics-cards {
    grid-template-columns: 1fr;
  }

  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 28px;
  }

  .analytics-cards {
    grid-template-columns: 1fr;
  }

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

  .profile-info {
    flex-direction: column;
    text-align: center;
  }

  .ig-profile-image {
    margin-right: 0;
    margin-bottom: 16px;
    width: 120px;
    height: 120px;
  }

  .profile-stats {
    justify-content: center;
  }
}

/* Error State Styling */
.profile-error-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  width: 100%;
  text-align: center;
  padding: 20px;
  background-color: var(--grum-light-gray);
  border-radius: var(--grum-border-radius);
}

.profile-error-illustration {
  width: 200px;
  height: 150px;
  margin-bottom: 15px;
}

.profile-error-illustration svg {
  max-width: 100%;
  max-height: 100%;
}

.profile-error-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-error-icon {
  font-size: 30px;
  margin-bottom: 10px;
}

.profile-error-icon i {
  background: linear-gradient(
    45deg,
    var(--grum-primary),
    var(--grum-button-hover)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-error-title {
  font-size: 15px;
  color: var(--grum-primary);
  margin-bottom: 5px;
  font-weight: 600;
}

.profile-error-description {
  color: var(--grum-dark-gray);
  max-width: 300px;
  line-height: 1.6;
}

/* Hide posts section when there's an error */
.posts-section.hidden {
  display: none;
}

/* Profile Error Styling */
.profile-error-container {
  display: flex;
  align-items: center;
  background-color: var(--grum-light-gray);
  border-radius: var(--grum-border-radius);
  padding: 15px;
}

.profile-error-icon {
  font-size: 30px;
  margin-right: 15px;
}

.profile-error-details {
  flex: 1;
}

.profile-error-title {
  color: var(--grum-primary);
  font-size: 15px;
  margin-bottom: 5px;
}

.profile-error-description {
  color: var(--grum-dark-gray);
}

/* Updated Posts Grid Styling */
.post-item {
  position: relative;
  border-radius: var(--grum-border-radius);
  overflow: hidden;
  height: 0;
  padding-bottom: 100%; /* Square aspect ratio */
  cursor: pointer;
  transition: var(--grum-transition);
}

.post-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(5px); /* Blur by default */
  transition: var(--grum-transition);
}

.post-item:hover .post-thumbnail {
  filter: blur(0); /* Clear on hover */
}
