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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  line-height: 1.7;
  color: #2d3748;
  background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  min-height: 100vh;
  position: relative;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.1);
  z-index: -1;
  animation: float 20s infinite linear;
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  color: white;
  margin-bottom: 50px;
  animation: fadeInUp 1s ease;
}

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

header h1 {
  font-size: 3.5em;
  margin-bottom: 15px;
  text-shadow: 0 4px 15px rgba(0,0,0,0.3);
  background: linear-gradient(45deg, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  letter-spacing: -1px;
}

header p {
  font-size: 1.4em;
  opacity: 0.95;
  font-weight: 300;
}

section {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  margin-bottom: 35px;
  padding: 40px;
  border-radius: 25px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

section:hover {
  transform: translateY(-8px);
  box-shadow: 0 35px 70px rgba(0,0,0,0.2);
}

h2 {
  color: #4c51bf;
  margin-bottom: 25px;
  font-size: 2.2em;
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 2px;
}

.search-container {
  margin-bottom: 25px;
}

#search-input {
  width: 100%;
  padding: 18px 25px;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  font-size: 16px;
  background: white;
  transition: all 0.3s;
}

#search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  transform: scale(1.02);
}

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

input, textarea, select {
  padding: 18px 25px;
  border: 2px solid #e2e8f0;
  border-radius: 15px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s;
  background: white;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
}

button {
  padding: 20px 35px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 25px;
}

.story-card {
  border: none;
  border-radius: 25px;
  padding: 30px;
  background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(248, 250, 252, 0.8));
  backdrop-filter: blur(15px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.3);
}

.story-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
}

.story-card:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: 0 30px 60px rgba(0,0,0,0.2);
  background: linear-gradient(145deg, rgba(255,255,255,1), rgba(248, 250, 252, 0.95));
}

.story-title {
  font-size: 1.7em;
  background: linear-gradient(45deg, #4c51bf, #667eea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 15px;
  line-height: 1.3;
}

.story-meta {
  color: #718096;
  font-size: 0.95em;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-meta i {
  color: #667eea;
}

.story-content {
  line-height: 1.7;
  margin-bottom: 20px;
  color: #4a5568;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-read-more {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s;
}

.story-read-more:hover {
  color: #764ba2;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 20px;
}

.btn-edit {
  background: linear-gradient(135deg, #48bb78, #38a169);
}

.btn-delete {
  background: linear-gradient(135deg, #f56565, #e53e3e);
}

.loading {
  text-align: center;
  padding: 60px 20px;
  font-size: 1.2em;
  color: #a0aec0;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 15px;
}

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

.error, .success {
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 25px;
  text-align: center;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.error {
  color: #f56565;
  background: rgba(253, 219, 216, 0.9);
  border: 1px solid rgba(245, 101, 101, 0.3);
}

.success {
  color: #38a169;
  background: rgba(213, 244, 230, 0.9);
  border: 1px solid rgba(56, 161, 105, 0.3);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 15px 25px;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.15));
  border-radius: 50px;
  margin-bottom: 25px;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
}

.back-link:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.35), rgba(255,255,255,0.25));
  transform: translateY(-2px);
}

.story-full {
  background: rgba(255,255,255,0.95);
  padding: 50px;
  border-radius: 25px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.3);
}

.story-meta-full {
  color: #718096;
  font-size: 1.2em;
  margin-bottom: 35px;
  display: flex;
  gap: 25px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}

.story-content-full {
  font-size: 1.3em;
  line-height: 1.9;
  white-space: pre-wrap;
  color: #2d3748;
}

@media (max-width: 768px) {
  header h1 {
    font-size: 2.5em;
  }
  
  section {
    padding: 25px;
    margin-bottom: 25px;
  }
  
  .story-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .container {
    padding: 15px;
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.slide-up {
  animation: slideUp 0.5s ease;
}

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