/**
 * =====================================================
 * 3D CMS PROJECT - STYLES
 * =====================================================
 */

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

:root {
  --primary: #007acc;
  --primary-dark: #005a9e;
  --secondary: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --light: #f8f9fa;
  --dark: #343a40;
  --border: #dee2e6;
  --shadow: rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

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

/* ===== HEADER ===== */
.header {
  background: white;
  box-shadow: 0 2px 4px var(--shadow);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

.logo a {
  color: inherit;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: #666;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.3s;
}

.nav-link:hover {
  background: var(--light);
  color: var(--primary);
}

.nav-link.active {
  color: var(--primary);
  font-weight: 600;
}

.user-info {
  color: #666;
  font-weight: 500;
}

/* ===== MAIN ===== */
.main {
  min-height: calc(100vh - 120px);
  padding: 2rem 0;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* ===== STATS ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 4px var(--shadow);
}

.stat-card h3 {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-card p {
  color: #666;
  font-size: 0.9rem;
}

/* ===== POSTS GRID ===== */
.posts-section {
  margin-top: 2rem;
}

.section-title {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  text-decoration: none;
  color: inherit;
  display: block;
}

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

.post-thumbnail {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--light);
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-content {
  padding: 1.2rem;
}

.post-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.post-description {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #999;
}

/* ===== POST DETAIL ===== */
.post-detail {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.post-header {
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--light);
  padding-bottom: 1rem;
}

.post-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.post-header-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: #666;
}

.post-description-box {
  background: var(--light);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.viewer-container {
  width: 100%;
  height: 600px;
  border-radius: 8px;
  overflow: hidden;
  background: #e0e0e0;
  margin-bottom: 1.5rem;
}

.viewer-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.post-info {
  display: flex;
  gap: 2rem;
  font-size: 0.9rem;
}

.info-item {
  display: flex;
  gap: 0.5rem;
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary, .btn-view, .btn-edit, .btn-toggle {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  opacity: 0.8;
}

.btn-block {
  width: 100%;
  text-align: center;
}

/* ===== TABLE ===== */
.table-container {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background: var(--light);
  padding: 0.8rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.table td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.table-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.badge {
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-draft {
  background: #fff3cd;
  color: #856404;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-view, .btn-edit, .btn-toggle {
  padding: 0.4rem 0.8rem;
  font-size: 1rem;
}

/* ===== AUTH PAGES ===== */
.auth-page {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.auth-card {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.auth-title {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.auth-subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 1.5rem;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-form label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.auth-form input, .auth-form textarea, .auth-form select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}

.auth-info {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #e7f3ff;
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  font-size: 0.85rem;
}

.auth-footer {
  margin-top: 1rem;
  text-align: center;
}

/* ===== ALERTS ===== */
.alert {
  padding: 0.8rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
}

/* ===== LOADING & STATES ===== */
.loading, .error-message, .empty-state {
  text-align: center;
  padding: 3rem;
}

.spinner {
  border: 4px solid var(--light);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ===== FOOTER ===== */
.footer {
  background: var(--dark);
  color: white;
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 3rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;
    gap: 1rem;
  }

  .hero h2 {
    font-size: 1.8rem;
  }

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

  .viewer-container {
    height: 400px;
  }

  .table-container {
    overflow-x: scroll;
  }
}
