/* ========================================= */
/* SOFTWARE TUTORIALS POPUP (NX / PSIM / CATIA) */
/* This file mirrors the card/grid style used in style.css (recording-card). */
/* ========================================= */

/* Popup container */
.popup-content.tool-popup{
  background: #b5b5b5;
}

/* Inner scroll area */
.tool-popup-inner{
  width:100%;
  height:100%;
  padding:18px;
  overflow:auto;
}

/* Title */
.tool-popup-title{
  margin:0 0 14px;
  font-size:24px;
  color:#222;
}

/* Grid (similar spacing to other grids in style.css) */
.tool-tutorial-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:20px;
  justify-items:center;
}

/* Card (copied style direction from .recording-card) */
.tool-tutorial-card{
  background: #7a7a7a;                /* Dark gray card background */
  border-radius: var(--radius);       /* Rounded corners */
  box-shadow: var(--shadow);          /* Drop shadow */
  padding: 14px;                      /* Inner spacing */
  display: flex;                      /* Vertical layout */
  flex-direction: column;
  align-items: center;                /* Center content */
  width: 100%;                        /* Fill grid cell */
  max-width: 650px;                   /* Prevent being too wide */
  text-decoration:none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;                    /* <-- added */
}

.tool-tutorial-card:hover{
  transform: translateY(-4px);        /* Slight upward lift */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); /* Stronger shadow */
}

/* Thumbnail (copied behavior from recording-card video sizing) */
.tool-tutorial-thumb{
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
  display:block;
}

/* Text */
.tool-tutorial-body{
  width:100%;
}

.tool-tutorial-name{
  margin: 10px 0 0;
  font-size: 1rem;
  color: #222;
  text-align: center;
  font-weight:700;
}

.tool-tutorial-desc{
  margin: 6px 0 0;
  font-size: .95rem;
  color: #222;
  text-align: center;
  font-style: italic;
  line-height: 1.35;
}

/* =========================
   Optional CAD download button
   ========================= */
.tool-card-actions{
  margin: 0 0 10px 0;
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  align-items: flex-start;
}

.tool-download-btn, .tool-action-btn{
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;

  padding: 9px 12px;
  border-radius: 10px;
  width: auto;
  min-height: 38px;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;

  background: rgba(255,255,255,0.25);
  color: #222;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.18);
}

.tool-download-btn:hover, .tool-action-btn:hover{
  background: rgba(255,255,255,0.35);
}

/* Button element reset (Open PDF) */
button.tool-action-btn{
  border: 1px solid rgba(0,0,0,0.18);
}

/* =========================
   PDF Viewer (inside popup)
   ========================= */
.tool-pdf-viewer{
  width:100%;
  height:70vh;
  max-height: 900px;
  background:#8a8a8a;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow:hidden;
  border: 1px solid rgba(0,0,0,0.18);
  margin: 12px 0 16px;
}

.tool-pdf-bar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.12);
  border-bottom: 1px solid rgba(0,0,0,0.15);
}

.tool-pdf-back{
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: rgba(255,255,255,0.25);
  color: #222;
  font-weight: 700;
}

.tool-pdf-back:hover{
  background: rgba(255,255,255,0.35);
}

.tool-pdf-open{
  text-decoration:none;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.25);
  color: #222;
  font-weight: 700;
}

.tool-pdf-open:hover{
  background: rgba(255,255,255,0.35);
}

.tool-pdf-viewer iframe{
  width:100%;
  height: calc(100% - 46px);
  border:0;
  display:block;
}

/* Responsive: stack to 1 column on small */
@media (max-width:900px){
  .tool-tutorial-grid{
    grid-template-columns: 1fr;
    gap:16px;
  }
  .tool-pdf-viewer{
    height: 62vh;
  }
}


@media (max-width: 480px){
  .tool-download-btn, .tool-action-btn{
    width: 100%;
  }
}


/* Actions placed above thumbnail */
.tool-card-actions-top{ width: 100%; }


/* --- Actions: keep card size fixed; 1 row normally; 2 rows ONLY when 5+ buttons --- */

/* Default: single row, scroll inside the card (card width never changes) */
.tool-card-actions{
  margin: 0 0 10px 0;
  width: 100%;
  display: flex;
  flex-wrap: nowrap;        /* 1 row */
  gap: 8px;
  justify-content: flex-start;
  align-items: center;

  overflow-x: auto;         /* if more buttons, scroll inside card */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;    /* Firefox */
}
.tool-card-actions::-webkit-scrollbar{ display: none; }

/* If there are 5+ buttons, switch to exactly 2 rows (still scrolls horizontally if needed) */
.tool-card-actions.is-two-row{
  display: grid;
  grid-auto-flow: column;          /* fill columns across 2 rows */
  grid-auto-columns: max-content;  /* each button sized to text */
  grid-template-rows: repeat(2, auto);
  column-gap: 8px;
  row-gap: 8px;

  overflow-x: auto;
  overflow-y: hidden;
}

/* In 5+ mode: keep all other buttons on row 1; only the download button goes to row 2 */
.tool-card-actions.is-two-row .tool-action-btn{ grid-row: 1; }
.tool-card-actions.is-two-row .tool-download-btn{ grid-row: 2; }


/* Buttons: fit content (no fixed widths), never wrap text */
.tool-download-btn,
.tool-action-btn{
  width: fit-content;       /* size to label text */
  max-width: 100%;
  flex: 0 0 auto;           /* don't stretch, don't shrink */
  white-space: nowrap;
}

/* Keep <a> buttons consistent */
.tool-card-actions a.tool-action-btn{ display: inline-flex; }

/* Override earlier mobile rule that forces 100% width */
@media (max-width: 480px){
  .tool-download-btn, .tool-action-btn{ width: fit-content; }
}
