/* ======================================
   DP5 ERP Dashboard - Main CSS
   Genel stiller, CSS değişkenleri, tema tanımları
   ====================================== */

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

/* CSS Custom Properties - Light Theme */
:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #38bdf8;
  --success: #16a34a;
  --warning: #ea580c;
  --danger: #dc2626;
  --info: #7c3aed;
  --bg-main: #f0f9ff;
  --bg-card: #ffffff;
  --bg-sidebar: #0284c7;
  --text-main: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --radius: 4px;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #0c4a6e;
  --text-main: #f1f5f9;
  --text-secondary: #cbd5e0;
  --text-muted: #94a3b8;
  --border: #334155;
}

/* Color Schemes - Sky (Default) */
body[data-scheme="sky"] {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #38bdf8;
  --bg-main: #f0f9ff;
  --bg-sidebar: #0284c7;
}

body[data-scheme="sky"][data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-sidebar: #0c4a6e;
}

/* Color Schemes - Desert */
body[data-scheme="desert"] {
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-light: #fb923c;
  --bg-main: #fff7ed;
  --bg-sidebar: #ea580c;
}

body[data-scheme="desert"][data-theme="dark"] {
  --bg-main: #1c1917;
  --bg-sidebar: #7c2d12;
}

/* Color Schemes - Grass */
body[data-scheme="grass"] {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #4ade80;
  --bg-main: #f0fdf4;
  --bg-sidebar: #16a34a;
}

body[data-scheme="grass"][data-theme="dark"] {
  --bg-main: #0f1e13;
  --bg-sidebar: #14532d;
}

/* Color Schemes - Space */
body[data-scheme="space"] {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --bg-main: #faf5ff;
  --bg-sidebar: #7c3aed;
}

body[data-scheme="space"][data-theme="dark"] {
  --bg-main: #1e1b4b;
  --bg-sidebar: #4c1d95;
}

/* Body Styles */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  transition: all 0.3s ease;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ======================================
   COMPONENT LIBRARY STYLES
   ====================================== */

/* Main Content Area - works with sidebar */
.main {
  margin-left: 260px;
  margin-top: 60px;
  margin-bottom: 45px;
  padding: 30px;
  min-height: calc(100vh - 105px);
  transition: margin-left 0.3s ease;
}

/* Adjust main content when sidebar is collapsed */
.sidebar.collapsed ~ .main {
  margin-left: 70px;
}

@media (max-width: 768px) {
  .main {
    margin-left: 70px;
    padding: 20px 15px;
  }
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Section */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 30px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

/* Component Layout */
.component-group {
  margin-bottom: 30px;
}

.component-group:last-child {
  margin-bottom: 0;
}

.component-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.component-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

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

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

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

.btn-success:hover {
  background: #15803d;
}

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

.btn-warning:hover {
  background: #c2410c;
}

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

.btn-danger:hover {
  background: #991b1b;
}

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

.btn-info:hover {
  background: #6d28d9;
}

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

.btn-secondary:hover {
  background: var(--text-main);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

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

.btn-outline-success {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
}

.btn-outline-success:hover {
  background: var(--success);
  color: white;
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-main);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge svg {
  width: 14px;
  height: 14px;
}

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

.badge-success {
  background: var(--success);
  color: white;
}

.badge-warning {
  background: var(--warning);
  color: white;
}

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

.badge-info {
  background: var(--info);
  color: white;
}

.badge-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.badge-outline-success {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
}

.badge-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-main);
  cursor: pointer;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-main);
  cursor: text;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-main);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Select elements cursor fix */
select.form-control {
  cursor: pointer !important;
}

select.form-control:not(:disabled):not(:read-only) {
  cursor: pointer !important;
}

select.form-control option {
  cursor: pointer;
}

/* Override any conflicting cursor styles for select elements */
select {
  cursor: pointer !important;
}

select:not(:disabled):not(:read-only) {
  cursor: pointer !important;
}

/* Checkbox & Radio */
.checkbox,
.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 10px;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox label,
.radio label {
  font-size: 14px;
  cursor: pointer;
}

/* Switch - Rectangular Design */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.switch-input {
  position: relative;
  width: 50px;
  height: 26px;
  cursor: pointer;
}

.switch-input input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: 2px;
  transition: 0.3s;
}

.switch-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 2px;
  transition: 0.3s;
}

.switch-input input:checked + .switch-slider {
  background: var(--primary);
}

.switch-input input:checked + .switch-slider:before {
  transform: translateX(24px);
}

.switch label {
  font-size: 14px;
  cursor: pointer;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 5px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--text-main);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  padding: 20px 0;
}

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

/* Accordion */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  transition: background 0.2s ease;
}

.accordion-header:hover {
  background: var(--bg-main);
}

.accordion-icon {
  transition: transform 0.3s ease;
  font-size: 18px;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
  max-height: 500px;
}

.accordion-body {
  padding: 16px 20px;
  color: var(--text-secondary);
}

/* Alert Messages */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-icon {
  flex-shrink: 0;
}

.alert-icon svg {
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.alert-message {
  font-size: 14px;
}

.alert-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.alert-warning {
  background: #fed7aa;
  color: #9a3412;
  border: 1px solid #fb923c;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #ddd6fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

/* Progress Bar */
.progress {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-bar.success {
  background: var(--success);
}

.progress-bar.warning {
  background: var(--warning);
}

.progress-bar.danger {
  background: var(--danger);
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
}

/* Table */
.table-container {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-main);
}

.table td {
  font-size: 14px;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--bg-main);
}

/* Pagination */
.pagination {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
  background: var(--bg-main);
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb-item {
  color: var(--text-secondary);
  cursor: pointer;
}

.breadcrumb-item:hover {
  color: var(--primary);
}

.breadcrumb-item.active {
  color: var(--text-main);
  font-weight: 500;
  cursor: default;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text span {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  display: none;
  z-index: 1000;
}

.dropdown-menu.active {
  display: block;
}

.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: var(--bg-main);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}

/* Tooltip */
.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg-card);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tooltip-wrapper:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title svg {
  width: 24px;
  height: 24px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon svg {
  width: 20px;
  height: 20px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 0;
  width: 20px;
  height: 20px;
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: var(--text-main);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast.danger {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--info);
}

/* Responsive Media Query */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 20px 15px;
  }

  .section {
    padding: 20px;
  }

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

  .toast {
    min-width: 280px;
  }

  .toast-container {
    right: 10px;
    left: 10px;
  }
}
