@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

/* === VARIABILE === */
:root {
  --font-main: 'Poppins', sans-serif;
  --color-bg: #191b41;
  --color-text: #fff;
  --color-muted: #777;
  --color-primary: #f8a81c;
  --color-primary-dark: #e89a17;
  --color-danger: #e53935;
  --color-success: #388e3c;
  --color-warning-bg: #fffbe6;
  --color-warning-text: #8c6d00;
  --radius: 6px;
  --border: 1px solid #ddd;
}

/* === RESET & BAZĂ === */
* { box-sizing: border-box; }

html {
  -ms-overflow-style: none;  /* IE și Edge */
  scrollbar-width: none;  /* Firefox */
}
html::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  padding: 20px;
  overflow-x: hidden; /* Previne scroll-ul orizontal */
}

h1 { margin-top: 50px; }
h2, h3 { margin-top: 0px; }
ul { padding-left: 20px; }

/* === LAYOUT === */
.creatix-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* === MULTIPLE FILES STYLING === */
.file-names {
  margin-top: 5px;
  max-height: 100px;
  overflow-y: auto;
}

.file-name-item {
  background: #f0f0f0;
  padding: 3px 8px;
  margin: 2px 0;
  border-radius: 3px;
  font-size: 11px;
  color: #333;
  border-left: 3px solid var(--color-primary);
  word-break: break-all;
}

.creatix-col {
  flex: 1 1 600px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 1024px) {
  .creatix-col {
    flex: 1 1 100%;
  }
}

/* === CARD === */
.creatix-card {
  background: white;
  color: #191b41;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  position: relative;
  margin-bottom: 20px;
}

.creatix-card.scrollable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.creatix-card.scrollable table {
  min-width: 720px;
  width: 100%;
}

.fullwidth {
  width: 100%;
  margin-top: 30px;
}

/* === FORM === */
form label {
  display: block;
  font-weight: 600;
}

input, select, textarea, button {
  font-family: inherit;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="file"],
input[type="number"],
input[type="password"],
textarea,
select,
.creatix-input {
  background: #f8f8f8;
  color: #191b41;
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

input[type="number"].creatix-input {
  width: 100%;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

textarea {
  resize: vertical;
}

/* STILIZARE SELECT PERSONALIZAT */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px; /* Spațiu pentru săgeată */
  cursor: pointer;
}

select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(248,168,28,0.2);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.creatix-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 15px;
  margin-top: 20px;
}

.operator-field {
  flex-grow: 1;
  max-width: 250px;
}

.operator-field label {
  margin-bottom: 2px;
  font-size: 14px;
}

.operator-field input {
  margin-bottom: 0;
}

.creatix-row {
  display: flex;
  margin-bottom: 10px;
  margin-top: 10px;
  gap: 20px;
}

.creatix-row > div {
  flex: 1 1 50%;
}

/* === STILURI FORMULAR PRODUSE MULTIPLE === */
/* Regula pentru #products-container a fost eliminată conform cerinței */

.product-group {
  border: 2px solid transparent;
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  position: relative;
  transition: all 0.2s ease;
  background: #f9f9f9;
}

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

.product-group.highlight,
.product-group:hover {
  background: #f5f5f5;
  border-color: #e0e0e0;
}

.product-group.selected {
  border-color: var(--color-primary);
  background: #fffaf0;
  box-shadow: 0 0 10px rgba(248,168,28,0.2);
}

.remove-product-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--color-danger);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: none; /* Afișat de JS */
  z-index: 5;
  padding: 0;
  text-align: center;
}
.remove-product-btn:hover {
  transform: scale(1.1);
  background: #c5302c;
}

.add-product-btn {
  background: var(--color-success);
  border: 2px solid var(--color-success);
  color: white;
  width: 100%;
  border-radius: var(--radius);
  padding: 12px;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 15px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.add-product-btn:hover {
  background: #2e7d32;
  border-color: #2e7d32;
  color: white;
}

/* === STILIZARE INPUT FIȘIER === */
input[type="file"] {
  display: none;
}
.custom-file-upload {
  border: 1px solid #ccc;
  display: inline-block;
  padding: 8px 12px;
  cursor: pointer;
  background-color: #f0f0f0;
  border-radius: var(--radius);
  width: 100%;
  text-align: center;
  transition: background-color 0.2s ease;
}
.custom-file-upload:hover {
  background-color: #e0e0e0;
}
.file-name {
  margin-left: 10px;
  font-style: italic;
  color: #555;
  font-size: 13px;
}

/* === STILIZARE CHECKBOX URGENT === */
.urgent-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.urgent-checkbox {
  width: 35px;
  height: 35px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

#date option,
#hour option {
  font-family: var(--font-main), sans-serif;
  padding: 5px 8px;
}

#date option {
  direction: ltr;
}

#hour option {
  text-align: center;
}

/* === BUTOANE === */
.creatix-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--color-primary);
  color: #000;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-transform: uppercase;
}

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

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

.creatix-btn.small {
  padding: 6px 12px;
  font-size: 13px;
  text-transform: none;
}

.creatix-btn.secondary {
  background: #eee;
  color: #333;
}

.status-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.status-btn {
  background: var(--color-primary);
  color: #191b41;
  border: none;
  width: 120px;
  padding: 5px 5px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s ease;
}

.status-btn:hover {
  filter: brightness(1.1);
}

.status-btn.cancel-order-btn {
  background: transparent;
  border: none;
  width: 30px;
  cursor: pointer;
  padding: 5px 0px;
  color: var(--color-danger);
  vertical-align: middle;
}

.status-btn.cancel-order-btn:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

/* Culori per status */
.status-in-asteptare .status-btn { background: #81b5ff; color: #000; }
.status-in-procesare .status-btn { background: #edca5c; color: #000; }
.status-finalizata .status-btn { background: #62f196; color: #000; }
.status-anulata .status-btn { background: #f57b86; color: #000; }

/* === ALERTĂ AGLOMERAȚIE === */
.creatix-alert {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  padding: 12px 20px;
  border-left: 5px solid var(--color-primary);
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 30px;
}

/* === TABEL === */
.creatix-orders-table {
  width: 100%;
  color: #191b41;
  border-radius: 6px;
  overflow: hidden;
  border-collapse: collapse;
  background: white;
  font-size: 14px;
  border: var(--border);
}

.creatix-orders-table th,
.creatix-orders-table td {
  padding: 12px 10px;
  border: var(--border);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transition: filter 0.15s ease-in-out;
}

.creatix-orders-table th {
  background: var(--color-primary);
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 600;
  color: #000; /* Culoare text pentru header */
}

/* Lățimi pentru tabel normal */
.creatix-orders-table th:nth-child(1),
.creatix-orders-table td:nth-child(1) {
  width: 0%;
  min-width: 100px;
}

.creatix-orders-table th:nth-child(2),
.creatix-orders-table td:nth-child(2) {
  width: 300px;
  text-transform: uppercase;
}

.creatix-orders-table th:nth-child(3),
.creatix-orders-table td:nth-child(3) {
  width: 5%;
  min-width: 140px;
  text-align: center;
  text-transform: uppercase;
}

.creatix-orders-table th:nth-child(4),
.creatix-orders-table td:nth-child(4) {
  width: 5%;
  min-width: 140px;
  text-align: center;
  text-transform: uppercase;
}

.creatix-orders-table th:nth-child(5),
.creatix-orders-table td:nth-child(5) {
  width: 0%;
  min-width: 200px;
}

.creatix-orders-table th:nth-child(6),
.creatix-orders-table td:nth-child(6) {
  width: 0%;
  min-width: 145px;
  text-align: center;
}

/* Lățimi pentru tabel admin */
.admin-orders-table th:nth-child(1),
.admin-orders-table td:nth-child(1) {
  min-width: 100px;
  text-align: left;
}

.admin-orders-table th:nth-child(2),
.admin-orders-table td:nth-child(2) {
  max-width: 100px;
  text-transform: uppercase;
  text-align: center;
}

.admin-orders-table th:nth-child(3),
.admin-orders-table td:nth-child(3) {
  width: 300px;
  text-align: left; /* Aliniere stânga pentru denumire */
}

.admin-orders-table th:nth-child(4),
.admin-orders-table td:nth-child(4) {
  width: 5%;
  min-width: 80px; /* Redus pentru a se potrivi cu cantitatea */
  text-align: center;
  text-transform: uppercase;
}

.admin-orders-table th:nth-child(5),
.admin-orders-table td:nth-child(5) {
  width: 5%;
  min-width: 140px;
  text-align: center;
  text-transform: uppercase;
}

.admin-orders-table th:nth-child(6),
.admin-orders-table td:nth-child(6) {
  width: 0%;
  min-width: 200px;
  text-align: right; /* Aliniere dreapta pentru livrare */
}

.admin-orders-table th:nth-child(7),
.admin-orders-table td:nth-child(7) {
  width: 0%;
  min-width: 145px;
  text-align: center;
}

/* === DETALII COMENZI === */
.creatix-order-details-row {
  background: #f1f1f1;
  padding: 20px;
  border-top: none;
  display: none;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease-in-out;
}

.creatix-order-details-row.detalii-deschise {
  display: table-row !important;
}

.creatix-order-details-row td {
  word-break: break-word;
  vertical-align: top;
  padding: 15px 10px;
  text-align: left; /* CORECTARE: Forțează alinierea la stânga */
}

.creatix-order-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  margin: 3px 0;
}

/* === DETALII: GRID STÂNGA/DREAPTA === */
.creatix-order-details .details-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.creatix-order-details .details-col,
.creatix-order-details .files-col {
  flex: 1 1 50%;
  min-width: 0; /* prevenim overflow */
}

.creatix-order-details h4 {
  margin: 4px 0 6px;
  color: #2c3e50;
}

.creatix-order-details .order-additional-details.empty p,
.creatix-order-details .order-files.empty p {
  color: #777;
}

.creatix-order-details .files-list a {
  color: var(--color-primary);
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(248, 168, 28, 0.1);
  border: 1px solid rgba(248, 168, 28, 0.2);
  transition: all 0.2s ease;
  display: inline-block;
  margin: 2px 6px 2px 0;
}

.creatix-order-details .files-list a:hover {
  background: rgba(248, 168, 28, 0.2);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .creatix-order-details .details-grid {
    flex-direction: column;
  }
}

.col-detalii {
  width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 16px;
}

.col-detalii strong {
  color: #2c3e50;
  font-size: 19px;
  margin-bottom: 3px;
  display: block;
}

/* === LISTĂ PRODUSE ÎN DETALII === */
.products-list {
  list-style: none;
  padding: 0;
  margin: 3px 20px;
}

.products-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #c4c4c4;
  color: #000;
}

.products-list li:last-child {
  border-bottom: none;
}

.product-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-name {
  flex: 2;
  font-weight: 500;
  color: #000;
  text-transform: uppercase;
  font-weight: 600;
}

.product-quantity {
  flex: 0 0 60px;
  text-align: right;
  font-weight: 600;
}

.product-method {
  flex: 1;
  color: #000;
  text-align: left;
}

.product-file {
  flex: 0 0 160px;
  text-align: right;
}

.product-file a {
  color: var(--color-primary);
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(248, 168, 28, 0.1);
  border: 1px solid rgba(248, 168, 28, 0.2);
  transition: all 0.2s ease;

}

.product-file a:hover {
  background: rgba(248, 168, 28, 0.2);
  transform: translateY(-1px);
}

.order-details-text {
  margin-top: 25px;
  padding-top: 5px;
  border-top: 1px solid #ddd;
  color: #000;
}

.order-details-text strong {
  color: #2c3e50;
  margin-bottom: -20px;
  display: block;
}

/* === TIMESTAMPS === */
.order-timestamps {
  margin-top: 5px;
  padding: 8px;
  background: #ecf0f1;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: #7f8c8d;
}

/* === FOOTER DETALII === */
.order-details-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #000;
  gap: 10px;
}

.order-details-footer .footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-details-footer .footer-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.order-details-footer .footer-operator strong,
.order-details-footer .footer-created strong,
.order-details-footer .footer-updated strong {
  color: #2c3e50;
}

.timestamps-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.order-operator {
  padding-right: 15px;
  border-right: 1px solid #d4d8d9;
}

.timestamps-right {
  display: flex;
  align-items: center;
}

.order-timestamps small {
  color: #7f8c8d;
  font-weight: 500;
}

/* === BUTON DESCĂRCARE === */
.download-all-btn {
  background: var(--color-success) !important;
  color: white !important;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  position: relative;
}

.download-all-btn:hover:not(:disabled) {
  background: #2e7d32 !important;
  transform: translateY(-1px);
}

.download-all-btn:active {
  transform: translateY(0);
}

.download-all-btn:disabled {
  cursor: not-allowed;
  transform: none !important;
}

/* === CONTAINER SCROLL TABEL === */
.creatix-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.creatix-table-wrapper table {
  min-width: 700px;
  width: 100%;
}

/* === STATUS RÂNDURI === */
.status-finalizata td { color: #000; background: #d7f8e3 }
.status-in-procesare td { color: #000; background: #fff3cd; }
.status-in-asteptare td { color: #000; background: #e7f1ff; font-weight: bold; }
.status-anulata td { color: #000; background: #f8d7da; }

.creatix-order:hover td {
  filter: brightness(95%);
  cursor: pointer;
}

/* === NOTIFICĂRI PUSH — eliminate la cerere === */

/* === TOAST === */
.creatix-toast {
  background: #d4edda;
  color: #155724;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: 0 0 6px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.creatix-toast.warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border-left: 4px solid var(--color-primary);
}

/* === OVERLAY === */
.creatix-overlay {
  position: fixed;
  color: var(--color-bg);
  inset: 0;
  background: rgba(255,255,255,0.92);
  z-index: 1000;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.creatix-form-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
  flex-direction: column;
  text-align: center;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.creatix-form-overlay.visible {
  display: flex;
}

.creatix-form-overlay .creatix-spinner {
  margin-bottom: 10px;
}

.creatix-form-overlay p {
  margin: 0;
  font-weight: 600;
  color: var(--color-bg);
}

.creatix-form-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.creatix-form-overlay button {
  margin-top: 20px;
}

.creatix-toast-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.creatix-toast-box {
  background: #fff;
  color: #191b41;
  padding: 20px 24px;
  border-radius: 8px;
  text-align: center;
  max-width: 90vw;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  animation: fadeInUp 0.3s ease;
}

.creatix-toast-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.order-cancel-reason {
  background: #f8d7da;
  color: #721c24;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-top: 10px;
  border: 1px solid #f5c6cb;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-cancel-reason strong {
  font-size: 15px;
  margin-bottom: 0;
  display: inline;
  flex-shrink: 0; /* Previne micsorarea textului "Motiv anulare:" */
}

.cancel-reason-container {
  margin: 15px 0;
  text-align: left;
}
.cancel-reason-container label {
  display: block;
  margin-bottom: 8px;
  cursor: pointer;
}
.cancel-reason-container input[type="radio"] {
  margin-right: 8px;
}
.cancel-reason-container textarea {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid #ccc;
  display: none; /* Ascuns inițial */
}

/* === SPINNER === */
.creatix-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--color-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

/* Spinner mic pentru butoane */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle; /* Aliniere verticală */
}

/* === URGENT BADGE === */
.urgent-badge {
  display: inline-block;
  position: absolute;
  margin-left: -10px;
  margin-top: -5px;
  color: #d80000;
  font-size: 2.2em;
  line-height: 1;
  vertical-align: middle;
  animation: buzzShake 0.6s infinite linear;
  transform-origin: center;
}

.creatix-order td:first-child {
  white-space: nowrap;
}

/* === ANIMAȚII === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-5px); }
}

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

@keyframes buzzShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-2px); }
  20% { transform: translateX(2px); }
  30% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  50% { transform: translateX(-1px); }
  60% { transform: translateX(1px); }
  70% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
  90% { transform: translateX(0); }
}


.creatix-alert-blink {
  background: #e53935 !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 16px;
  padding: 12px 20px;
  border-left: 5px solid #fff;
  border-radius: var(--radius);
  margin-bottom: 10px;
  text-align: center;
  min-width: 220px;
  min-height: 24px;
  animation: creatix-blink 1s linear infinite;
  box-shadow: 0 2px 12px rgba(229,57,53,0.15);
}
@keyframes creatix-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === BUTON ÎNCARCĂ MAI MULTE === */
.load-more-btn-container {
  text-align: right;
  margin: 10px 0 0 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}