/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #6C63FF;
  --primary-dark: #5848E8;
  --secondary-color: #FF6584;
  --success-color: #4CAF50;
  --danger-color: #F44336;
  --text-dark: #2C3E50;
  --text-light: #7F8C8D;
  --bg-primary: #F5F7FA;
  --bg-white: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================
   AUTHENTICATION PAGES (Login/Register)
   ============================================ */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #6C63FF 0%, #FF6584 100%);
  position: relative;
  overflow: hidden;
}

.auth-container::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  top: -100px;
  right: -100px;
  animation: float 6s ease-in-out infinite;
}

.auth-container::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  bottom: -50px;
  left: -50px;
  animation: float 8s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.auth-card {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease-out;
}

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

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h1 {
  font-size: 32px;
  color: var(--primary-color);
  margin-bottom: 8px;
  font-weight: 700;
}

.auth-header p {
  color: var(--text-light);
  font-size: 14px;
}

.auth-form {
  margin-bottom: 20px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #E8EBED;
  border-radius: 12px;
  font-size: 15px;
  transition: var(--transition);
  background: #F8F9FA;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--bg-white);
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
}

.input-hint {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.auth-btn, .submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.auth-btn:hover, .submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.auth-btn:active, .submit-btn:active {
  transform: translateY(0);
}

.submit-btn span {
  margin-right: 8px;
}

.auth-footer {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
}

.auth-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.auth-footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.error-message {
  background: #FFEBEE;
  color: var(--danger-color);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  border-left: 4px solid var(--danger-color);
}

.success-message {
  background: #E8F5E9;
  color: var(--success-color);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  border-left: 4px solid var(--success-color);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  background: var(--bg-white);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand h2 {
  font-size: 24px;
  color: var(--primary-color);
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.logout-btn, .back-btn {
  padding: 8px 20px;
  background: var(--bg-primary);
  color: var(--text-dark);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}

.logout-btn:hover, .back-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 80px;
}

/* ============================================
   FEED CONTAINER
   ============================================ */
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.empty-state h3 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--text-dark);
}

.empty-state p {
  color: var(--text-light);
  margin-bottom: 24px;
}

.empty-btn {
  padding: 12px 32px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.empty-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ============================================
   POST CARDS
   ============================================ */
.card {
  background: var(--bg-white);
  padding: 24px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: fadeIn 0.5s ease-out;
}

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

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

.post-header {
  margin-bottom: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.user-info strong {
  color: var(--text-dark);
  font-size: 15px;
}

.post-title {
  font-size: 20px;
  color: var(--text-dark);
  margin-bottom: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.post-url {
  display: inline-block;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  background: rgba(108, 99, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 16px;
  transition: var(--transition);
  word-break: break-all;
}

.post-url:hover {
  background: rgba(108, 99, 255, 0.2);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #E8EBED;
}

.like-count {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.like-btn {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--secondary-color), #FF4569);
  color: white;
  border: none;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(255, 101, 132, 0.3);
}

.like-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 101, 132, 0.4);
}

.like-btn:active {
  transform: scale(0.98);
}

/* ============================================
   PROFILE SECTION
   ============================================ */
.profile-container {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.profile-header {
  text-align: center;
  margin-bottom: 32px;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 40px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.3);
}

.profile-header h2 {
  color: var(--text-dark);
  font-size: 28px;
  margin-bottom: 8px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-item {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.stat-label {
  display: block;
  font-size: 14px;
  color: var(--text-light);
  font-weight: 500;
}

.section-title {
  font-size: 20px;
  color: var(--text-dark);
  margin-bottom: 16px;
  font-weight: 600;
}

.user-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: 12px;
  transition: var(--transition);
}

.link-item:hover {
  background: #E8EBED;
  transform: translateX(4px);
}

.link-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-title {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 15px;
}

.link-url-small {
  font-size: 12px;
  color: var(--text-light);
  word-break: break-all;
}

.link-likes {
  font-weight: 700;
  color: var(--secondary-color);
  font-size: 16px;
  white-space: nowrap;
  margin-left: 12px;
}

.empty-links {
  text-align: center;
  padding: 40px 20px;
}

.empty-links p {
  color: var(--text-light);
  margin-bottom: 20px;
}

.add-link-btn {
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.add-link-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ============================================
   FORM CONTAINER (Add Post Page)
   ============================================ */
.form-container {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  max-width: 600px;
  margin: 0 auto;
}

.form-header {
  text-align: center;
  margin-bottom: 32px;
}

.form-header h2 {
  font-size: 28px;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.form-header p {
  color: var(--text-light);
  font-size: 14px;
}

.modern-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================
   PREVIEW PANEL
   ============================================ */
#previewPanel {
  position: fixed;
  bottom: -100%;
  left: 0;
  width: 100%;
  height: 65vh;
  background: var(--bg-white);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  overflow: hidden;
  z-index: 1000;
}

#previewPanel.active {
  bottom: 0;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-primary);
  font-weight: 600;
  color: var(--text-dark);
}

.preview-header button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-dark);
  transition: var(--transition);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.preview-header button:hover {
  background: #E8EBED;
}

#iframeContainer {
  height: calc(100% - 60px);
  padding: 0;
}

#iframeContainer iframe {
  border: none;
  width: 100%;
  height: 100%;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-white);
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 200;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px 20px;
  border-radius: 12px;
  color: var(--text-light);
}

.nav-icon {
  font-size: 24px;
  transition: var(--transition);
}

.nav-label {
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--primary-color);
  background: rgba(108, 99, 255, 0.1);
}

.nav-item:hover:not(.active) {
  color: var(--text-dark);
  background: var(--bg-primary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
  .auth-card {
    padding: 32px 24px;
  }
  
  .navbar {
    padding: 14px 16px;
  }
  
  .nav-brand h2 {
    font-size: 20px;
  }
  
  .main-content {
    padding: 16px;
  }
  
  .card {
    padding: 20px;
  }
  
  .post-title {
    font-size: 18px;
  }
  
  .profile-container {
    padding: 24px;
  }
  
  .form-container {
    padding: 24px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
  }
  
  .auth-header h1 {
    font-size: 28px;
  }
  
  .navbar {
    padding: 12px;
  }
  
  .nav-brand h2 {
    font-size: 18px;
  }
  
  .main-content {
    padding: 12px;
  }
  
  .card {
    padding: 16px;
  }
  
  .post-title {
    font-size: 16px;
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .like-btn {
    padding: 8px 20px;
    font-size: 14px;
  }
  
  .profile-container {
    padding: 20px;
  }
  
  .profile-avatar-large {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }
  
  .profile-header h2 {
    font-size: 24px;
  }
  
  .stat-number {
    font-size: 28px;
  }
  
  .form-container {
    padding: 20px;
  }
  
  .form-header h2 {
    font-size: 24px;
  }
  
  .bottom-nav {
    padding: 8px 0;
  }
  
  .nav-item {
    padding: 6px 12px;
  }
  
  .nav-icon {
    font-size: 20px;
  }
  
  .nav-label {
    font-size: 11px;
  }
}

/* Small Mobile */
@media (max-width: 360px) {
  .auth-card {
    padding: 24px 16px;
  }
  
  .card {
    padding: 14px;
  }
  
  .profile-stats {
    gap: 12px;
  }
  
  .stat-item {
    padding: 16px;
  }
}
