/* assets/css/portal.css */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Base */

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f7f9fc;
  margin: 0;
  padding: 20px;
  color: #2c3e50;
}

.portal-container {
  max-width: 1100px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 10px;
  padding: 20px 24px 30px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.06);
}

/* Header */

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #e3e8f0;
  padding-bottom: 14px;
}

.portal-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.portal-logo {
  font-size: 2.1rem;
  line-height: 1;
}

.portal-subtitle {
  margin: 2px 0 0;
  font-size: 0.95rem;
  color: #6b7789;
}

.portal-user-box {
  text-align: right;
  font-size: 0.9rem;
}

.portal-user-name {
  font-weight: 600;
}

.portal-user-email {
  color: #6b7789;
  margin-bottom: 6px;
}

.small {
  font-size: 12px;
  color: #666;
}

footer {
  margin-top: 20px;
  text-align: center;
  color: #777;
  font-size: 13px;
}
/* Main content */

.portal-main {
  margin-top: 22px;
}

/* Apps grid */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.app-card {
  border-radius: 10px;
  border: 1px solid #dde3f0;
  background: #f5f7fc;
  padding: 16px 14px 18px;
}

.app-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.app-desc {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: #4b5563;
}

.app-role {
  margin: 0 0 12px;
  font-size: 0.88rem;
}

.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e3edff;
  font-size: 0.8rem;
  text-transform: capitalize;
}

/* Buttons */

.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: #0069d9;
  color: #ffffff;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: #0053b1;
}

.btn-outline {
  background: transparent;
  color: #0069d9;
  border: 1px solid #c4d4f3;
}

.btn-outline:hover {
  background: #e8f0ff;
}

.btn-secondary {
  background: #6b7280;
}

.btn-secondary:hover {
  background: #4b5563;
}

/* Admin block */

.portal-admin {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px dashed #d1d5db;
}

.portal-admin h3 {
  margin: 0 0 6px;
}

/* Flash messages */

.portal-flash-wrapper {
  margin-bottom: 14px;
}

/* Responsive */

@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .portal-container {
    padding: 14px 12px 18px;
  }

  .portal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-user-box {
    text-align: left;
  }
}

.login-form {
  max-width: 350px;
  margin: 2em auto;
  padding: 2em;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fdfdfd;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-form h2 {
  margin-bottom: 1em;
  text-align: center;
}
.login-form label {
  display: block;
  margin-top: 1em;
  font-weight: bold;
}
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.5em;
  margin-top: 0.3em;
  box-sizing: border-box;
}
.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1em 0;
  font-size: 0.9em;
}
.login-options .forgot-link {
  text-decoration: none;
  color: #0066cc;
}
.login-options .forgot-link:hover {
  text-decoration: underline;
}
.login-form button {
  width: 100%;
  padding: 0.6em;
  background-color: #2b7bb9;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.login-form button:hover {
  background-color: #235d8c;
}

/* === Flash messages === */
.flash {
  padding: 12px 18px;
  margin: 15px 0;
  border-radius: 6px;
  font-weight: bold;
  font-size: 15px;
  position: relative;
  opacity: 0.95;
  animation: fadein 0.5s ease;
}

.flash-success {
  background: #2ecc71;
  color: #fff;
}
.flash-error {
  background: #e74c3c;
  color: #fff;
}
.flash-warning {
  background: #f39c12;
  color: #fff;
}
.flash-info {
  background: #3498db;
  color: #fff;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 0.95;
    transform: translateY(0);
  }
}

@keyframes fadeout {
  from {
    opacity: 0.95;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.flash.hide {
  animation: fadeout 0.5s forwards;
}

/* ---- TABLE CLEAN ---- */
table.clean {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

table.clean th {
    background: #f3f6fa;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    color: #2c3e50;
    font-weight: 600;
}

table.clean td {
    padding: 2px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

table.clean tr:nth-child(even) {
    background: #fafafa;
}

table.clean tr:hover {
    background: #eef4ff;
}

/* Actions icons */
table.clean td a {
    margin-right: 8px;
    font-size: 18px;
    text-decoration: none;
}
table.clean td a:hover {
    opacity: 0.7;
}

.rights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  font-size: 0.82em;
  line-height: 1.2em;
}

.rights-grid div strong {
  color: #333;
}

.legend {
  font-size: 0.85em;
  color: #555;
  margin-bottom: 5px;
}
.rights-badges span {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.9em;
}

.badge-admin {
  background: #ff9800; /* orange */
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: bold;
}

.badge-super {
  background: #d32f2f; /* rouge foncé */
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: bold;
}

.badge-invite {
  background: #9e9e9e; /* gris */
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: bold;
}


/* ---- COLOR DOT ---- */
.color-dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #ccc;
}

/* ---- FORMULAIRES ---- */
form {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
    max-width: 500px;
}

.form-group {
    margin-bottom: 5px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="color"],
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.form-group input[type="checkbox"] {
    margin-right: 6px;
}

/* ---- RETURN LINK ---- */
a.btn-secondary {
    display: inline-block;
    padding: 7px 12px;
    background: #777;
    color: white;
    border-radius: 6px;
    text-decoration: none;
}
a.btn-secondary:hover {
    background: #555;
}

/* ---- LAYOUT ---- */
.page-actions {
    margin-bottom: 20px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    table.clean th,
    table.clean td {
        padding: 8px;
        font-size: 13px;
    }
    form {
        max-width: 100%;
    }
    .portal-logo img {
    height: auto; /* Ne force pas la hauteur */
    width: 100%; 
    max-width: 700px; /* sécurité */
    display: block;
    margin: 0 auto; /* Centré */
  }
}

.filter-bar {
    margin: 10px 0 15px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #ddd;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.filter-bar label {
    margin: 0;
    font-weight: 600;
}
.filter-bar select {
    min-width: 220px;
}


/* ---- TITRES ---- */
h1 {
    font-size: 26px;
    margin-bottom: 20px;
    color: #2c3e50;
}

/* ---- BOUTONS ---- */
.btn {
    display: inline-block;
    background: var(--main-blue, #0069d9);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn:hover {
    background: var(--main-blue-dark, #0053aa);
    text-decoration: none;
}
.btn:active {
    transform: scale(0.97);
}

.mail-icon {
  position: relative;
  cursor: pointer;
}

.mail-icon:hover::after {
  content: attr(data-mail);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 0.78em;
  line-height: 1.2em;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  z-index: 30;
}

.mail-icon::after {
  content: "";
  opacity: 0;
  transform: translateX(-50%) translateY(4px); /* léger glissé vers le bas */
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.multi-site-rights {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 6px 20px;
}

.multi-site-rights label {
  font-size: 0.9em;
}

.select-colored {
  position: relative;
  display: inline-block;
}

.select-colored select {
  padding: 4px 6px;
  font-size: 0.9em;
  border-radius: 4px;
  border: 1px solid #aaa;
  color: white; /* important */
  appearance: none;      /* supprime la flèche native */
  -moz-appearance: none; 
  -webkit-appearance: none;
}

/* Petite icône flèche */
.select-colored::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  pointer-events: none;
  color: white;
  font-size: 0.8em;
}

/* Couleurs du fond selon le droit */
.select-colored[data-selected="superadmin"] select {
  background: #d32f2f !important;
}

.select-colored[data-selected="admin"] select {
  background: #ff9800 !important;
}

.select-colored[data-selected="utilisateur"] select {
  background: #1976d2 !important;
}

.select-colored[data-selected="invite"] select {
  background: #9e9e9e !important;
}

/* Quand une app est désactivée */
.disabled-app {
  opacity: 0.45;
  filter: grayscale(80%);
  pointer-events: none; /* empêche toute interaction */
}

/* Bouton désactivé */
.btn-disabled {
  background: #ccc !important;
  color: #666 !important;
  cursor: not-allowed;
  pointer-events: none;
  border-color: #999 !important;
}

.app-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Hauteur uniforme sans contrainte rigide */
    min-height: 200px;
}

.app-card h2 {
    margin-top: 0;
}

.app-desc {
    flex-grow: 1; /* pousse la description pour uniformiser */
}

.app-role {
    margin-top: 10px;
    margin-bottom: 20px;
}

.app-card .btn {
    margin-top: auto; /* pousse le bouton en bas */
}

/* à adapter à ta classe de formulaire si tu veux cibler plus finement */
.user-form input[type="text"],
.user-form input[type="email"],
.user-form input[type="password"] {
  height: 1.5rem;        /* hauteur fixe */
  line-height: 1.5rem;   /* aligne le texte verticalement */
  padding: 0 0.5rem;     /* padding uniforme */
  box-sizing: border-box;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
}


.password-wrapper {
  position: relative;
  display: flex;
  align-items: stretch; /* important : la hauteur suit celle de l'input */
}

.password-wrapper input {
  width: 100%;
  padding-right: 2.5rem; /* place pour l’œil */
}


.toggle-password {
  position: absolute;
  right: 8px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* œil par défaut */
.toggle-password.show {
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'>\
<path d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 12a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/></svg>");
}

/* œil barré */
.toggle-password.hide {
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'>\
<path d='M12 4.5C7 4.5 2.73 7.61 1 12c.62 1.57 1.58 2.96 2.77 4.11l-2.12 2.12 1.41 1.41 18-18-1.41-1.41-3.06 3.06C15.07 4.76 13.57 4.5 12 4.5zm0 12a4.44 4.44 0 0 1-2.5-.78l1.63-1.63a2.5 2.5 0 0 0 2.5-2.5c0-.47-.13-.9-.34-1.28l1.64-1.64c.76.95 1.21 2.16 1.21 3.42a4.5 4.5 0 0 1-4.5 4.5zM6.93 14.07a4.45 4.45 0 0 1 0-4.14C8.07 8.73 9.92 7.5 12 7.5c.92 0 1.79.2 2.58.57l1.56-1.56A10.81 10.81 0 0 0 12 6c-5 0-9.27 3.11-11 7.5.71 1.8 1.87 3.36 3.27 4.55l2.66-2.66z'/></svg>");
}

.password-hint {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1rem;
}
