/* Temel stiller */
:root {
  --primary-color: #1C5D99;
  --secondary-color: #28AFB0;
  --dark-color: #33261D;
  --light-color: #F3F4FF;
  --danger-color: #e74c3c;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 80px;
  --header-height: 70px;
  --mobile-nav-height: 60px;
}

/* Profile in header */
.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}
.profile-btn img#profileAvatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f3f3;
}
.profile-btn .profile-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.profile-btn .profile-meta span { font-weight: 600; }
.profile-btn .profile-meta small { color: #666; }

.profile-menu {
  position: absolute;
  right: 20px;
  top: calc(var(--header-height) - 6px);
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
  min-width: 200px;
  overflow: hidden;
  z-index: 1200;
}
.profile-menu button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: #fff;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.profile-menu button:hover { background: #f6f7fb; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}
.modal-dialog {
  width: 520px;
  max-width: 95vw;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
}
.modal-body { padding: 16px; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; }

.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.avatar-upload img#profilePreview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f3f3;
  border: 1px solid #e6e6e6;
}
.avatar-upload input[type="file"] { display: none; }
.profile-fields { flex: 1; }
.form-row { display: flex; gap: 16px; align-items: flex-start; }

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

body {
  background-color: #f5f7fa;
  color: var(--dark-color);
}

/* Giriş Sayfası Stilleri */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  padding: 20px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 450px;
  animation: fadeIn 0.5s ease;
}

.login-box .logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-box .logo img {
  width: 100px;
  height: auto;
  margin-bottom: 15px;
}

.login-box .logo h2 {
  color: var(--primary-color);
  font-size: 1.8rem;
}

.login-box .form-group {
  margin-bottom: 20px;
}

.login-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--dark-color);
  font-weight: 500;
}

.login-box input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  transition: border 0.3s;
}

.login-box input:focus {
  border-color: var(--secondary-color);
  outline: none;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-login:hover {
  background: #154a7a;
}

.error-message {
  color: var(--danger-color);
  margin-top: 15px;
  text-align: center;
  font-size: 14px;
}

/* Admin Panel Stilleri */
.admin-container {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding-bottom: var(--mobile-nav-height);
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--primary-color);
  color: white;
  transition: all 0.3s;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
}

.admin-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

@media (max-width: 992px) {
  .admin-sidebar {
    width: 100%;
    height: var(--mobile-nav-height);
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }
  
  .admin-sidebar.collapsed {
    width: 100%;
  }
  
  .admin-logo {
    display: none;
  }
  
  .admin-nav ul {
    display: flex;
    padding: 0;
    height: 100%;
    align-items: center;
    justify-content: space-around;
  }
  
  .admin-nav li {
    flex: 1;
    text-align: center;
  }
  
  .admin-nav li a {
    flex-direction: column;
    padding: 8px 5px;
    font-size: 0.7rem;
    border-left: none;
    border-top: 3px solid transparent;
    height: 100%;
    justify-content: center;
  }
  
  .admin-nav li a i {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
  }
  
  .admin-nav li a span {
    display: block;
    opacity: 1 !important;
    width: auto !important;
  }
  
  .admin-main {
    margin-left: 0 !important;
    padding-bottom: var(--mobile-nav-height);
  }
  
  .admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
  }
  
  .admin-content {
    padding-top: calc(var(--header-height) + 20px);
  }
  
  #sidebarToggle {
    display: none;
  }
}

/* Genel chart block stili ve canvas boyutlandırma */
.dashboard-chart-block {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(28,93,153,0.07);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-chart-block h3 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.dashboard-chart-block .chart-desc {
  margin-top: 8px;
}

.dashboard-chart-block canvas {
  width: 100% !important;
  height: auto !important; /* allow flex to control height */
  display: block;
  flex: 1 1 auto;
}

/* Dergi istatistik kutusu yüksekliği */
.dashboard-chart-block.magazine-stats {
  height: 320px;
  padding: 24px 24px 24px 24px;
}

.admin-logo {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-logo img {
  width: 50px;
  height: auto;
  margin-bottom: 10px;
}

.admin-logo h2 {
  font-size: 1.2rem;
  margin: 0;
  transition: all 0.3s;
}

.admin-sidebar.collapsed .admin-logo h2 {
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.admin-nav ul {
  list-style: none;
  padding: 15px 0;
}

.admin-nav li a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s;
  border-left: 4px solid transparent;
  white-space: nowrap;
}

.admin-nav li a:hover, 
.admin-nav li a.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-left-color: var(--secondary-color);
}

@media (max-width: 992px) {
  .admin-nav li a:hover,
  .admin-nav li a.active {
    border-left: none;
    border-top: 3px solid var(--secondary-color);
    background: rgba(255, 255, 255, 0.1);
  }
}

.admin-nav li a i {
  margin-right: 10px;
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.admin-sidebar.collapsed .admin-nav li a span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.admin-main {
  flex: 1;
  transition: all 0.3s;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

.admin-main.collapsed {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
}

@media (max-width: 992px) {
  .admin-main,
  .admin-main.collapsed {
    width: 100%;
    margin-left: 0;
  }
}

.admin-header {
  height: var(--header-height);
  width: 100%;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

#sidebarToggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--dark-color);
  cursor: pointer;
  margin-right: 20px;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-profile span {
  font-weight: 500;
}

.admin-content {
  padding: 20px;
  min-height: calc(100vh - var(--header-height) - var(--mobile-nav-height));
}

@media (min-width: 993px) {
  .admin-content {
    min-height: calc(100vh - var(--header-height));
  }
}

.content-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.content-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
}

.btn-primary {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #1f9a9b;
}

.btn-secondary {
  background: #e0e0e0;
  color: var(--dark-color);
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

/* Form Stilleri */
.form-container {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark-color);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 15px;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group input {
  width: auto;
}

/* Tablo Stilleri */
.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.admin-table th {
  background: var(--light-color);
  color: var(--dark-color);
  font-weight: 600;
}

.admin-table tr:hover {
  background: #f9f9f9;
}

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

.badge {
  background: var(--secondary-color);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn-edit,
.btn-delete {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

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

.header-left{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Responsive */
@media (max-width: 992px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
  }
  
  .admin-sidebar.active {
    transform: translateX(0);
  }
  
  .admin-main {
    margin-left: 0;
    width: 100%;
  }
  
  #sidebarToggle {
    display: block;
  }
}

@media (max-width: 768px) {
  .login-box {
    padding: 30px 20px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 15px;
  }
}

/* Dashboard kartları ve grafik blokları için modern stil */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 32px;
}

.stats-section-header {
  margin-top: 40px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 10px;
}

.stats-section-header h3 {
  font-size: 1.4rem;
  color: #333;
  margin: 0;
}
.stat-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(28,93,153,0.07);
  padding: 28px 32px;
  min-width: 220px;
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.stat-title {
  font-size: 1.1rem;
  color: #1C5D99;
  margin-bottom: 8px;
  font-weight: 600;
}
.stat-value {
  font-size: 2.1rem;
  color: #28AFB0;
  font-weight: bold;
}
/* Ziyaretçi trendi kutusu için daha fazla alan */
.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 32px;
  margin-bottom: 32px;
}
#magazineStatsBlock {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}
#topPagesBlock {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

/* 1400px altında Top Pages tam genişlik olsun */
@media (max-width: 1400px) {
  #topPagesBlock {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
  }
  #visitorTrendBlock {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
  }
}
#visitorTrendBlock {
  grid-column: 1 / 3;
  grid-row: 2 / 3;
}
@media (max-width: 900px) {
  .dashboard-charts {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  #magazineStatsBlock, #topPagesBlock, #visitorTrendBlock {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Sadece ziyaretçi trendi kutusunu büyük yap */
.dashboard-chart-block.visitor-trend {
  flex: 2 1 900px;
  min-width: 500px;
  max-width: 100%;
  height: 380px;
  padding: 32px 32px 24px 32px;
}
@media (max-width: 900px) {
  .dashboard-chart-block.visitor-trend {
    min-width: 0;
    height: 260px;
    padding: 16px 8px 8px 8px;
  }
}

/* En çok ziyaret edilen sayfalar kutusu: daha büyük ve geniş */
.dashboard-chart-block.top-pages {
  height: 320px; /* dergi istatistikleri ile aynı yükseklik */
  padding: 24px 24px 24px 24px;
  max-width: 100%;
}
@media (max-width: 900px) {
  .dashboard-chart-block.top-pages {
    min-width: 0;
    max-width: 100%;
    height: 180px;
    padding: 12px 6px 6px 6px;
  }
}