/* ==========================================================================
   KODEVO | STRONA GŁÓWNA - 3 KAFELKI (STYLE.CSS)
   Czysta, biała estetyka, bez koloru, bez zbędnych wodotrysków.
   ========================================================================== */

:root {
  --bg-page: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-dark: #0f172a;

  --btn-bg: #0f172a;
  --btn-text: #ffffff;
  --btn-bg-hover: #1e293b;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ==========================================================================
   WIDOK 1: 3 KAFELKI (TILES)
   ========================================================================== */

.view-tiles {
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--bg-page);
}

/* Header */
.tiles-header {
  padding: 1.5rem 2.5rem;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo-kodevo {
  height: 30px;
  width: auto;
  object-fit: contain;
}

.header-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-light);
}

.header-tag {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Main Cards Container */
.tiles-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.5rem 2.5rem 2.5rem;
}

.tiles-container {
  width: 100%;
  max-width: 1440px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: stretch;
}

/* Individual Tile */
.config-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  outline: none;
  transition: transform 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
  user-select: none;
}

.config-tile:hover, .config-tile:focus-visible {
  transform: translateY(-4px);
  border-color: var(--border-medium);
  box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.08);
}

/* Image at the top of the card */
.tile-image-wrapper {
  width: 100%;
  height: 240px;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
  display: block;
}

.config-tile:hover .tile-img {
  transform: scale(1.03);
}

/* Card Content */
.tile-content {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.tile-top {
  margin-bottom: 0.75rem;
}

.tile-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.tile-body {
  margin-bottom: 1.5rem;
}

.tile-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.625rem;
  letter-spacing: -0.01em;
}

.tile-desc {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Action Button */
.tile-action {
  margin-top: auto;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1.125rem;
  border-radius: 10px;
  background-color: var(--btn-bg);
  color: var(--btn-text);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 200ms ease;
}

.arrow-icon {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
}

.config-tile:hover .action-btn {
  background-color: var(--btn-bg-hover);
}

.config-tile:hover .arrow-icon {
  transform: translateX(4px);
}

/* Footer */
.tiles-footer {
  padding: 1.25rem 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ==========================================================================
   WIDOK 2: AKTYWNY KONFIGURATOR (FULLSCREEN)
   ========================================================================== */

.view-active {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
}

/* Header aktywnego widoku */
.active-header {
  height: 52px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
  z-index: 50;
}

.active-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: var(--font-family);
}

.btn-back:hover {
  background: var(--bg-hover);
  border-color: var(--border-dark);
}

.active-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-light);
}

/* Quick Switcher */
.quick-switcher {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: var(--font-family);
}

.quick-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.quick-btn.active {
  color: var(--btn-text);
  background: var(--btn-bg);
  border-color: var(--btn-bg);
}

/* External Link */
.btn-external {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  transition: color 150ms ease;
}

.btn-external:hover {
  color: var(--text-primary);
}

.icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Fullscreen Iframe */
.active-iframe-container {
  flex: 1;
  width: 100%;
  height: calc(100% - 52px);
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.active-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ==========================================================================
   RESPONSYWNOŚĆ (MOBILE & TABLET)
   ========================================================================== */

@media (max-width: 1024px) {
  .tiles-header {
    padding: 1.25rem 1.25rem;
  }

  .tiles-main {
    padding: 0.5rem 1.25rem 2rem 1.25rem;
    align-items: flex-start;
  }

  .tiles-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .tile-image-wrapper {
    height: 200px;
  }

  .tile-content {
    padding: 1.25rem;
  }

  .tile-title {
    font-size: 1.25rem;
  }

  .active-header {
    padding: 0 0.75rem;
    height: 48px;
  }

  .active-iframe-container {
    height: calc(100% - 48px);
  }

  .active-divider,
  .btn-external {
    display: none;
  }

  .quick-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.6875rem;
  }
}
