/* assets/css/style.css */
:root {
  --orange: #ff7a00;
  --orange-dark: #e56a00;
  --text-light: #ffffff;
  --text-dark: #333333;
  --bg-light: #f9f9f9;
  --white: #fff;
  --success: #28a745;
  --error: #dc3545;
}

/* Reset et base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
}
body, html {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

/* Container principal */
.container {
  display: flex;
  height: 100vh;
}

/* LOGIN / REGISTER */
.left-panel {
  flex: 1;
  position: relative;
  background: var(--orange);
  overflow: hidden;
}
.left-panel img.bg-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}
.overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-light);
  padding: 0 20px;
  max-width: 80%;
}
.overlay h1,
.overlay h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.overlay p {
  font-size: 1rem;
  line-height: 1.5;
}
.right-panel {
  flex: 1;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  padding: 40px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.logo i {
  color: var(--orange);
  font-size: 1.5rem;
  margin-right: 0.5rem;
}
h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}
.subtitle {
  text-align: center;
  margin-bottom: 2rem;
  color: #666;
  font-size: 0.9rem;
}
.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}
.form-group input {
  width: 100%;
  padding: 16px 12px 8px 40px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color .3s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--orange);
}
.form-group label {
  position: absolute;
  top: 50%;
  left: 40px;
  transform: translateY(-50%);
  pointer-events: none;
  background: #fff;
  padding: 0 4px;
  font-size: 1rem;
  color: #888;
  transition: all .3s;
}
.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
  top: -8px;
  font-size: 0.8rem;
  color: var(--orange);
}
.form-group label::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--orange);
  transition: width .3s;
}
.form-group input:focus + label::before {
  width: 100%;
}
.form-group .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #000;
  font-size: 1.1rem;
  transition: color .3s;
}
.form-group input:focus ~ .icon {
  color: var(--orange);
}
.options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.options a {
  color: var(--orange);
  text-decoration: none;
}
.options a:hover {
  text-decoration: underline;
}
.btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--orange);
  color: var(--text-light);
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.btn i {
  margin-right: 0.5rem;
}
.signup {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}
.signup a {
  color: var(--orange);
  text-decoration: none;
  font-weight: bold;
}
@media(max-width: 768px) {
  .container { flex-direction: column; }
  .left-panel, .right-panel { width: 100%; height: 50vh; }
  .login-card { margin-top: -50px; }
}

/* DASHBOARD - éléments communs */
aside .logo {
  color: var(--white);
  font-size: 1.25rem;
  font-weight: bold;
  padding: 20px;
  display: flex;
  align-items: center;
}
aside .logo i {
  margin-right: 8px;
}
nav ul {
  list-style: none;
}
nav li {
  color: var(--white);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
nav li.active,
nav li:hover {
  background: var(--orange-dark);
}
nav li i {
  margin-right: 12px;
}
.logout {
  margin: 20px;
  color: var(--white);
  display: flex;
  align-items: center;
  cursor: pointer;
}
.logout i {
  margin-right: 8px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
header .titles h1 {
  font-size: 1.75rem;
  color: var(--text-dark);
}
header .titles p {
  color: #666;
  margin-top: 4px;
}
.btn-add {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
}
.btn-add i {
  margin-right: 6px;
}
.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 20px;
  margin-top: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.card-header i {
  color: var(--orange);
  margin-right: 8px;
}
.card-header h2 {
  font-size: 1.1rem;
  color: var(--text-dark);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 12px;
}
th {
  background: var(--bg-light);
  font-weight: normal;
  color: #555;
}
tr + tr {
  border-top: 1px solid #eee;
}
.a {
  text-decoration: none;
  color: var(--white);
}

/* Bouton toggle (mobile) */
.toggle-btn {
  position: fixed;
  left: 10px;
  top: 5px;
  background: var(--orange);
  color: var(--text-light);
  border: none;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1001;
  display: block;
}

/* Sidebar : mobile par défaut (caché) */
aside {
  width: 245px;
  background: var(--orange);
  position: fixed;
  top: 0;
  left: -245px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: left 0.4s ease;
  z-index: 1000;
}
aside.active {
  left: 0;
}

/* Main */
main {
  flex: 1;
  background: var(--bg-light);
  padding: 40px;
  margin-left: 0;
  transition: margin-left 0.3s ease;
  width: 100%;
  z-index: 900;
  position: relative;
}

/* Ajustement table mobile */
td, th {
  padding: 8px;
  font-size: 14px;
  white-space: nowrap;
}
td:last-child {
  width: 80px;
  text-align: center;
}
td:last-child a {
  margin: 0 5px;
  display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
  .toggle-btn { display: block; }
  aside { left: -245px; }
  aside.active { left: 0; }
  main { margin-left: 0; }
  main.shifted { margin-left: 245px; }
  table {
    display: block;
    overflow-x: auto;
  }
  td, th { min-width: 100px; }
}

/* ✅ Desktop : sidebar fixe */
@media (min-width: 769px) {
  aside {
    left: 0;
    position: fixed;
    top: 0;
    height: 100%;
    z-index: 1000;
  }
  .toggle-btn {
    display: none;
  }
  main {
    margin-left: 245px;
    width: calc(100% - 245px);
    position: relative;
  }
}

/*dashboard*/
#ticketsTable {
  width: 100%;
  border-collapse: collapse;
}
#ticketsTable th,
#ticketsTable td {
  padding: 0.5rem;
  border: 1px solid #ddd;
  text-align: left;
}
#ticketsTable thead {
  background: #f5f5f5;
}

.fa-triangle-exclamation {
  color: #dc3545;
}

/* Search */
.search-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 1rem 0;
}
.search-box i {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
  font-size: 1rem;
}
.search-box input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.search-box input:focus {
  outline: none;
  border-color: #007bff;
}

/* Spinner */
.loader {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 6px solid var(--bg-light);
  border-top: 6px solid var(--orange);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
.login-card { position: relative; }
.btn .btn-loader { margin-left: 0.5rem; }

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  top: auto;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  min-width: 250px;
  max-width: 350px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: 4px;
  color: var(--text-light);
  font-size: 0.9rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s;
  position: relative;
  z-index: 10000;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast i { margin-right: 8px; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Toast de confirmation */
.toast.confirm {
  flex-direction: column;
  align-items: stretch;
  z-index: 10001;
  background: var(--white);
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.toast.confirm .toast-message {
  margin-bottom: 0.75rem;
}
.toast.confirm .toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.toast.confirm .toast-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.toast.confirm .btn-cancel {
  background: var(--error);
  color: var(--text-light);
}
.toast.confirm .btn-ok {
  background: var(--success);
  color: var(--text-light);
}
