/* 
 * WATER RESCUE - Stylesheet pour vp.youspire.tn
 */

:root {
  --primary: #4d97ff;
  --primary-dark: #2d73dc;
  --secondary: #ffab19;
  --accent: #00cec9;
  --danger: #ff4757;
  --success: #2ed573;
  --dark: #1e272e;
  --light: #f8f9fa;
  --gray: #718093;
  --border: #e1e8ed;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f1f3f6;
  color: #2c3e50;
  line-height: 1.6;
}

/* NAVBAR */
.navbar {
  background: linear-gradient(135deg, #1e3799, #0984e3);
  color: white;
  padding: 12px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
  color: white;
  white-space: nowrap;
}

.brand-badge {
  background: var(--secondary);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.domain-tag {
  font-size: 13px;
  background: rgba(255,255,255,0.25);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* MODE SWITCHER */
.mode-switcher {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.mode-btn {
  background: white;
  border: 2px solid var(--border);
  color: var(--dark);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.mode-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: linear-gradient(135deg, #0984e3, #4d97ff);
  color: white;
  border-color: #0984e3;
  box-shadow: 0 6px 16px rgba(9, 132, 227, 0.3);
}

/* SCRATCH STUDIO IFRAME CONTAINER */
.studio-container {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  border: 2px solid var(--border);
  margin-bottom: 40px;
}

.studio-header {
  background: #1e272e;
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-title {
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-badge {
  background: #ffab19;
  color: #1e272e;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 6px;
}

.scratch-iframe {
  width: 100%;
  height: 760px;
  border: none;
  display: block;
}

.split-atelier {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-bottom: 40px;
}

.atelier-guide-panel {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  max-height: 760px;
  overflow-y: auto;
}

@media (max-width: 992px) {
  .split-atelier {
    grid-template-columns: 1fr;
  }
}

.nav-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.2);
}

/* CONTAINER */
.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

/* HERO / GAME SECTION */
.game-section {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  margin-bottom: 40px;
  text-align: center;
}

.section-header {
  margin-bottom: 20px;
}

.section-header h1 {
  font-size: 30px;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.section-header p {
  color: var(--gray);
  font-size: 16px;
}

/* SCRATCH STAGE WRAPPER */
.stage-wrapper {
  background: #2f3542;
  border-radius: 12px;
  overflow: hidden;
  display: inline-block;
  border: 4px solid #57606f;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  max-width: 100%;
}

.stage-topbar {
  background: #4d97ff;
  color: white;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: bold;
}

.stage-buttons {
  display: flex;
  gap: 10px;
}

.btn-flag {
  background: #2ed573;
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-stop {
  background: #ff4757;
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
}

#scratch-canvas {
  display: block;
  background: #2f3640;
  width: 640px;
  height: 480px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
}

/* TOUCH CONTROLS (Mobile & Tablet) */
.touch-controls {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 16px;
}

.touch-btn {
  background: linear-gradient(135deg, #0984e3, #74b9ff);
  color: white;
  border: none;
  padding: 14px 28px;
  font-size: 22px;
  font-weight: bold;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(9, 132, 227, 0.35);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.touch-btn:active {
  transform: scale(0.95);
  background: #0984e3;
}

.game-controls-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.action-btn {
  background: #f1f2f6;
  border: 1px solid #ced6e0;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  background: #dfe4ea;
}

/* CARDS GRID (Downloads & Resources) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.resource-card {
  background: white;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.card-icon {
  font-size: 32px;
  background: #eaf2ff;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--dark);
}

.card-desc {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 18px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0984e3, #00cec9);
  color: white;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 15px;
  text-align: center;
  transition: opacity 0.2s;
}

.download-btn:hover {
  opacity: 0.9;
}

.download-btn.orange {
  background: linear-gradient(135deg, #ff9f43, #ee5253);
}

.download-btn.green {
  background: linear-gradient(135deg, #2ed573, #10ac84);
}

/* TUTORIAL TABS & CONTENT */
.tutorial-section {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  margin-bottom: 40px;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}

.tab-btn {
  background: #f1f2f6;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

.step-panel h3 {
  color: #0984e3;
  margin-bottom: 12px;
  font-size: 22px;
}

.step-panel p {
  margin-bottom: 16px;
  color: #4b6584;
}

.screenshot-container {
  text-align: center;
  margin: 20px 0;
}

.screenshot-img {
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}

.screenshot-img:hover {
  transform: scale(1.01);
}

/* SERVER / DEPLOYMENT INFO SECTION */
.deploy-section {
  background: #1e272e;
  color: white;
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 40px;
}

.deploy-section h2 {
  color: #00cec9;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.code-box {
  background: #2f3640;
  border-radius: 8px;
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  color: #f1f2f6;
  overflow-x: auto;
  margin: 15px 0;
  border-left: 4px solid var(--accent);
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--gray);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

@media (max-width: 768px) {
  .navbar { flex-direction: column; gap: 10px; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .tab-nav { overflow-x: auto; flex-wrap: nowrap; }
}
