/* =========================================================
   RINGLINK — GLOBAL STYLES
   ========================================================= */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;

  --text: #0f172a;
  --text-soft: #64748b;
  --text-light: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;

  --border: #e2e8f0;

  --radius: 18px;
  --radius-small: 12px;

  --shadow:
    0 10px 30px rgba(15, 23, 42, 0.06);

  --shadow-hover:
    0 18px 40px rgba(15, 23, 42, 0.10);
}


/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background:
    radial-gradient(circle at top left,
      rgba(37, 99, 235, 0.07),
      transparent 35%),
    var(--bg);

  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}


/* =========================================================
   MAIN CONTAINER
   ========================================================= */

.container {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 60px;
}


/* =========================================================
   HEADINGS
   ========================================================= */

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--text);
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  margin-bottom: 8px;
}

h2 {
  font-size: 22px;
  font-weight: 750;
  margin-bottom: 20px;
}

h3 {
  font-size: 18px;
}

p {
  color: var(--text-soft);
  line-height: 1.65;
}


/* =========================================================
   HEADER
   ========================================================= */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 28px;
}

header h1 {
  margin-bottom: 0;
}


/* =========================================================
   CARDS
   ========================================================= */

.card {
  background: rgba(255, 255, 255, 0.92);

  border: 1px solid var(--border);
  border-radius: var(--radius);

  padding: 26px;
  margin-top: 20px;

  box-shadow: var(--shadow);

  backdrop-filter: blur(10px);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-hover);
}


/* =========================================================
   FORMS
   ========================================================= */

form {
  display: grid;
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;

  color: var(--text);

  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;

  padding: 13px 15px;

  border: 1px solid #cbd5e1;
  border-radius: var(--radius-small);

  background: #ffffff;
  color: var(--text);

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

input::placeholder {
  color: #94a3b8;
}

input:hover {
  border-color: #94a3b8;
}

input:focus {
  border-color: var(--primary);

  background: #ffffff;

  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.12);
}


/* =========================================================
   BUTTONS
   ========================================================= */

button {
  border: none;

  background: var(--primary);
  color: white;

  padding: 13px 18px;

  border-radius: var(--radius-small);

  cursor: pointer;

  font-weight: 750;
  font-size: 14px;

  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

button:hover {
  background: var(--primary-hover);

  box-shadow:
    0 8px 20px rgba(37, 99, 235, 0.20);

  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}


/* =========================================================
   LOGOUT
   ========================================================= */

#logout {
  background: #f1f5f9;
  color: #334155;

  border: 1px solid #e2e8f0;
}

#logout:hover {
  background: #e2e8f0;
  color: #0f172a;

  box-shadow: none;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.message {
  margin-top: 14px;

  padding: 0;

  color: var(--danger);

  font-size: 14px;
  font-weight: 600;
}


/* =========================================================
   RING LIST
   ========================================================= */

#ring-info,
#rings-list {
  display: grid;
  gap: 14px;
}


/* =========================================================
   RING CARD
   ========================================================= */

.ring-card {
  position: relative;

  padding: 20px;

  border: 1px solid var(--border);
  border-radius: 15px;

  background:
    linear-gradient(145deg,
      #ffffff,
      #f8fafc);

  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ring-card:hover {
  transform: translateY(-2px);

  border-color: #bfdbfe;

  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.08);
}

.ring-card strong {
  display: block;

  margin-bottom: 10px;

  color: var(--text);

  font-size: 16px;
}

.ring-card p {
  margin: 8px 0;
  font-size: 14px;
}

.ring-card p strong {
  display: inline;
  margin: 0;
}


/* =========================================================
   RING BUTTON
   ========================================================= */

.select-ring {
  margin-top: 12px;

  background: var(--primary-soft);
  color: var(--primary);

  border: 1px solid #bfdbfe;

  box-shadow: none;
}

.select-ring:hover {
  background: #dbeafe;
  color: var(--primary-hover);

  box-shadow: none;
}


/* =========================================================
   LINKS
   ========================================================= */

.ring-card a {
  word-break: break-all;

  font-weight: 600;
}

.ring-card a:hover {
  text-decoration: underline;
}


/* =========================================================
   LOGIN PAGE
   ========================================================= */

/*
   Ton login HTML n'a pas de classe spécifique.
   On le détecte grâce au formulaire #login-form.
*/

body:has(#login-form) {
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 100vh;

  padding: 20px;
}

body:has(#login-form) .container {
  width: min(440px, 100%);

  padding: 38px;

  background: rgba(255, 255, 255, 0.95);

  border: 1px solid var(--border);
  border-radius: 24px;

  box-shadow:
    0 25px 70px rgba(15, 23, 42, 0.10);
}

body:has(#login-form) h1 {
  text-align: center;

  font-size: 38px;

  margin-bottom: 8px;
}

body:has(#login-form) .container>p {
  text-align: center;

  margin-bottom: 30px;
}

body:has(#login-form) #login-form button {
  margin-top: 4px;

  width: 100%;

  padding: 14px;
}


/* =========================================================
   ADMIN PAGE
   ========================================================= */

body:has(#rings-list) .container {
  width: min(1000px, calc(100% - 32px));
}

body:has(#rings-list) .card:first-of-type {
  border-top: 3px solid var(--primary);
}


/* =========================================================
   USER PAGE
   ========================================================= */

body:has(#ring-info) .card:first-of-type {
  border-top: 3px solid var(--primary);
}

body:has(#ring-info) .card:nth-of-type(2) {
  border-top: 3px solid #0ea5e9;
}

body:has(#ring-info) .card:nth-of-type(3) {
  border-top: 3px solid #8b5cf6;
}


/* =========================================================
   STATUS
   ========================================================= */

.ring-card p:last-of-type {
  font-weight: 600;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 700px) {

  .container {
    width: min(100% - 22px, 900px);
    padding-top: 24px;
  }

  header {
    align-items: flex-start;
    flex-direction: column;
  }

  header button {
    width: 100%;
  }

  .card {
    padding: 20px;
    border-radius: 15px;
  }

  body:has(#login-form) {
    padding: 12px;
  }

  body:has(#login-form) .container {
    padding: 28px 22px;
    border-radius: 20px;
  }

  body:has(#login-form) h1 {
    font-size: 32px;
  }

  .ring-card {
    padding: 16px;
  }

  .ring-card button {
    width: 100%;
  }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 420px) {

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .card {
    padding: 17px;
  }

  body:has(#login-form) .container {
    padding: 24px 18px;
  }
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}