/* assets/css/admin-panel.css */

/* --- Temel Ayarlar ve Reset (Admin Paneli için) --- */
@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&family=Roboto:wght@300;400;700&display=swap");

:root {
  --admin-primary-color: #28a745; /* Yeşil - Başarı ve kontrol hissi */
  --admin-secondary-color: #007bff; /* Mavi - Bilgi ve bağlantı */
  --admin-accent-color: #ffc107; /* Sarı - Uyarı ve dikkat */
  --admin-danger-color: #dc3545; /* Kırmızı - Hata ve kritik */
  --admin-text-color: #343a40;
  --admin-light-bg: #f8f9fa;
  --admin-dark-bg: #343a40; /* Sidebar için koyu arka plan */
  --admin-white: #ffffff;
  --admin-border-color: #e9ecef;

  --font-heading: "Oswald", sans-serif;
  --font-body: "Roboto", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--admin-text-color);
  background-color: var(--admin-light-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: var(--admin-secondary-color);
  transition: color 0.3s ease;
}

a:hover {
  color: #0056b3;
}

ul {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  color: var(--admin-text-color);
  margin-bottom: 15px;
  line-height: 1.2;
}

/* --- Admin Login Page --- */
.admin-login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(
    135deg,
    var(--admin-primary-color) 0%,
    #32cd32 100%
  );
}

.login-container {
  background-color: var(--admin-white);
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-box h2 {
  font-size: 2.2em;
  margin-bottom: 30px;
  color: var(--admin-text-color);
}

.login-box h2 i {
  margin-right: 10px;
  color: var(--admin-primary-color);
}

.login-box .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.login-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--admin-text-color);
}

.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--admin-border-color);
  border-radius: 5px;
  font-size: 1em;
  color: var(--admin-text-color);
  transition: border-color 0.3s ease;
}

.login-box input[type="text"]:focus,
.login-box input[type="password"]:focus {
  border-color: var(--admin-primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--admin-primary-color), 0.2);
}

.btn-login {
  background-color: var(--admin-primary-color);
  color: var(--admin-white);
  padding: 12px 25px;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.3s ease, transform 0.2s ease;
  margin-top: 10px;
}

.btn-login:hover {
  background-color: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.login-box .message-area {
  margin-top: 20px;
  padding: 10px;
  border-radius: 5px;
  font-weight: 600;
  display: none;
}

.login-box .message-area.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.login-box .message-area.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.login-box .back-to-site {
  margin-top: 25px;
  font-size: 0.9em;
}

.login-box .back-to-site a {
  color: var(--admin-secondary-color);
}
.login-box .back-to-site a i {
  margin-right: 5px;
}

/* --- Admin Panel Layout --- */
.admin-body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--admin-dark-bg);
  color: var(--admin-white);
  padding: 20px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
  color: var(--admin-white);
  font-size: 1.8em;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav ul li {
  margin-bottom: 10px;
}

.sidebar-nav ul li a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 5px;
  transition: background-color 0.3s ease, color 0.3s ease;
  font-size: 1.1em;
}

.sidebar-nav ul li a i {
  margin-right: 15px;
  font-size: 1.3em;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li a.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--admin-primary-color);
}

.admin-main-content {
  flex-grow: 1;
  padding: 30px;
}

.admin-header {
  background-color: var(--admin-white);
  padding: 20px 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  margin: 0;
  font-size: 2em;
  color: var(--admin-text-color);
}

.user-info span {
  font-weight: 600;
  color: var(--admin-secondary-color);
}

/* --- Dashboard Widgets --- */
.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.widget {
  background-color: var(--admin-white);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.2s ease;
}

.widget:hover {
  transform: translateY(-5px);
}

.widget-icon {
  font-size: 2.5em;
  color: var(--admin-primary-color);
  background-color: rgba(var(--admin-primary-color-rgb), 0.1);
  padding: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-content h3 {
  margin-bottom: 5px;
  font-size: 1.1em;
  color: var(--admin-text-color);
}

.widget-value {
  font-size: 2em;
  font-weight: 700;
  color: var(--admin-secondary-color);
  margin-bottom: 5px;
}

.widget-trend {
  font-size: 0.9em;
  font-weight: 600;
}

.widget-trend.positive {
  color: var(--admin-primary-color);
}
.widget-trend.negative {
  color: var(--admin-danger-color);
}

.widget-trend i {
  margin-right: 5px;
}

/* Specific widget styling */
.total-visitors .widget-icon {
  background-color: rgba(40, 167, 69, 0.1);
  color: #28a745;
}
.page-views .widget-icon {
  background-color: rgba(0, 123, 255, 0.1);
  color: #007bff;
}
.new-customers .widget-icon {
  background-color: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}
.critical-stock .widget-icon {
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

/* --- Dashboard Charts and Tables --- */
.dashboard-charts {
  display: grid;
  grid-template-columns: 2fr 1fr; /* Larger chart, smaller list */
  gap: 25px;
  margin-bottom: 30px;
}

.chart-card {
  background-color: var(--admin-white);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-card h2 {
  font-size: 1.5em;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--admin-border-color);
  padding-bottom: 10px;
}

/* Canvas yüksekliği düzeltmesi */
#trafficChart {
  height: 400px !important; /* Sabit yükseklik */
  width: 100% !important; /* Genişlik */
  display: block;
  box-sizing: border-box;
}

.popular-products-list {
  margin-top: 15px;
}

.popular-products-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--admin-border-color);
  font-size: 1em;
  color: var(--admin-text-color);
}

.popular-products-list li:last-child {
  border-bottom: none;
}

.popular-products-list .badge {
  background-color: var(--admin-primary-color);
  color: var(--admin-white);
  padding: 4px 8px;
  border-radius: 15px;
  font-size: 0.8em;
  font-weight: 600;
}

/* --- Quick Actions --- */
.quick-actions {
  margin-bottom: 30px;
}

.quick-actions h2 {
  font-size: 1.8em;
  margin-bottom: 25px;
  color: var(--admin-text-color);
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.action-card {
  background-color: var(--admin-white);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: var(--admin-text-color);
}

.action-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.action-card i {
  font-size: 3em;
  color: var(--admin-primary-color);
  margin-bottom: 15px;
}

.action-card h3 {
  font-size: 1.3em;
  margin-bottom: 10px;
}

.action-card p {
  font-size: 0.9em;
  color: #6c757d;
}

/* Kritik Eşik Ayarları Bölümü */
.critical-threshold-section {
  margin-bottom: 30px;
}

.critical-threshold-section .card {
  padding: 25px;
}

.critical-threshold-section .form-group {
  margin-bottom: 15px;
}

.critical-threshold-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.critical-threshold-section input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--admin-border-color);
  border-radius: 4px;
  font-size: 1em;
}

.critical-threshold-section .btn-primary {
  background-color: var(--admin-primary-color);
  color: var(--admin-white);
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.critical-threshold-section .btn-primary:hover {
  background-color: #218838;
}

/* --- Product Management (products.html) --- */
.product-management {
  display: grid;
  grid-template-columns: 2fr 1fr; /* Ürün tablosu geniş, ekleme dar */
  gap: 25px;
}

.card {
  background-color: var(--admin-white);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 25px;
}

.card h2 {
  font-size: 1.5em;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--admin-border-color);
  padding-bottom: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.data-table th,
.data-table td {
  border: 1px solid var(--admin-border-color);
  padding: 12px 15px;
  text-align: left;
}

.data-table th {
  background-color: var(--admin-light-bg);
  font-weight: 600;
  color: var(--admin-text-color);
  text-transform: uppercase;
  font-size: 0.9em;
}

.data-table td {
  vertical-align: middle;
}

.data-table .stock-input {
  width: 80px;
  padding: 8px;
  border: 1px solid var(--admin-border-color);
  border-radius: 4px;
  text-align: center;
}

.status-ok {
  color: #28a745; /* Green */
  font-weight: 600;
}
.status-low {
  color: #ffc107; /* Yellow */
  font-weight: 600;
}
.status-critical {
  color: #dc3545; /* Red */
  font-weight: 600;
}

.status-ok i,
.status-low i,
.status-critical i {
  margin-right: 5px;
}

.btn-update {
  background-color: var(--admin-secondary-color);
  color: var(--admin-white);
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-right: 5px; /* Sil butonu ile aralık */
}

.btn-update:hover {
  background-color: #0056b3;
}

.btn-delete {
  background-color: var(--admin-danger-color);
  color: var(--admin-white);
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-delete:hover {
  background-color: #c82333;
}

.add-product-card .form-group {
  margin-bottom: 15px;
}

.add-product-card label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.add-product-card input[type="text"],
.add-product-card input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--admin-border-color);
  border-radius: 4px;
}

.add-product-card .btn-primary {
  background-color: var(--admin-primary-color);
  color: var(--admin-white);
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  transition: background-color 0.3s ease;
}

.add-product-card .btn-primary:hover {
  background-color: #218838;
}

/* --- Modal Styles (for QR Code) --- */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1050; /* Sit on top, higher than other content */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.6); /* Black w/ opacity */
  display: flex; /* Flexbox for centering */
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
}

.modal-content {
  background-color: var(--admin-white);
  margin: auto;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  width: 90%;
  max-width: 500px;
  text-align: center;
  animation: fadeInScale 0.3s ease-out; /* Modal açılış animasyonu */
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.8em;
  color: var(--admin-text-color);
  margin-bottom: 25px;
}

.modal-content .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.modal-content label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.modal-content input[type="url"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--admin-border-color);
  border-radius: 5px;
}

.modal-content .btn-primary {
  width: auto;
  padding: 10px 25px;
  font-size: 1em;
  margin-top: 15px;
}

.qr-code-display {
  margin-top: 25px;
  border: 1px dashed var(--admin-border-color);
  padding: 20px;
  min-height: 150px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.qr-code-display canvas {
  max-width: 200px;
  height: auto;
  border: 1px solid var(--admin-border-color);
}

.qr-code-display p {
  color: #6c757d;
}

.modal-content .btn-secondary {
  background-color: var(--admin-secondary-color);
  color: var(--admin-white);
  padding: 10px 25px;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  margin-top: 20px;
}

.modal-content .btn-secondary:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}

.close-button {
  position: absolute;
  top: 15px;
  right: 25px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus {
  color: #333;
  text-decoration: none;
}

/* --- Responsive Admin Panel --- */
@media (max-width: 992px) {
  .admin-body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding: 15px 20px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
  }

  .sidebar-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }
  .sidebar-header h3 {
    font-size: 1.5em;
  }

  .sidebar-nav {
    display: none; /* Mobil menü JS ile açılıp kapanacak */
    position: absolute;
    top: 70px; /* Header yüksekliği */
    left: 0;
    width: 100%;
    background-color: var(--admin-dark-bg);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    max-height: 0; /* JS ile kontrol edilecek */
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
  }
  .sidebar-nav.active {
    max-height: 300px; /* Menü yüksekliği */
  }

  .sidebar-nav ul {
    flex-direction: column;
    padding: 10px 0;
  }
  .sidebar-nav ul li {
    margin-bottom: 0;
  }
  .sidebar-nav ul li a {
    padding: 10px 20px;
    justify-content: center;
  }

  .admin-main-content {
    padding: 20px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px 20px;
    margin-bottom: 20px;
  }
  .admin-header h1 {
    font-size: 1.8em;
    margin-bottom: 10px;
  }
  .user-info {
    width: 100%;
    text-align: right;
  }

  .dashboard-widgets,
  .dashboard-charts,
  .actions-grid,
  .product-management {
    grid-template-columns: 1fr; /* Tek sütun */
    gap: 20px;
  }

  .chart-card.large-card,
  .chart-card.small-card {
    padding: 20px;
  }

  .add-product-card {
    margin-top: 20px;
  }
}

@media (max-width: 768px) {
  .login-container {
    padding: 30px;
    margin: 20px;
  }
  .login-box h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
  }
  .btn-login {
    font-size: 1em;
    padding: 10px 20px;
  }

  .dashboard-widgets,
  .dashboard-charts,
  .actions-grid,
  .product-management {
    gap: 15px;
  }

  .widget,
  .action-card,
  .chart-card,
  .card {
    padding: 20px;
  }

  .widget-icon {
    font-size: 2em;
    padding: 12px;
  }
  .widget-value {
    font-size: 1.8em;
  }

  .data-table th,
  .data-table td {
    padding: 10px;
    font-size: 0.9em;
  }
  .data-table .stock-input {
    width: 60px;
    padding: 6px;
  }
  .btn-update {
    padding: 6px 10px;
  }

  .modal-content {
    padding: 25px;
  }
  .modal-content h2 {
    font-size: 1.5em;
  }
  .modal-content input,
  .modal-content button {
    padding: 10px;
    font-size: 0.9em;
  }
}

/* Sidebar toggle for mobile */
.sidebar-toggle {
  display: none; /* Masaüstünde gizli */
  background: none;
  border: none;
  cursor: pointer;
  color: var(--admin-white);
  font-size: 1.5em;
  padding: 5px;
}

@media (max-width: 992px) {
  .sidebar-toggle {
    display: block;
  }
}

/* Stil için ekledim: Eğer sidebar mobil görünümde aktifse hamburger ikonunu kapatma ikonuna çevireceğiz */
.sidebar.active .sidebar-toggle .fa-bars {
  display: none;
}

.sidebar.active .sidebar-toggle .fa-times {
  display: inline-block;
}

.sidebar-toggle .fa-times {
  display: none; /* Varsayılan olarak çarpı gizli */
}
