* { box-sizing: border-box; }
html, body { height: 100%; margin: 0;}
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; font-family: Arial, Helvetica, sans-serif; background: #f5f5f5; color: #333;}
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }
main.wrap {flex: 1; width: 100%; margin: 0 auto; padding: 1rem;}

/* Header / Top */
header.site-header {background: #222;color: #fff; padding: 20px 20px; }
header.site-header .wrap {display: flex;justify-content: space-between;align-items: center;}
header.site-header a {color: #fff;text-decoration: none;font-weight: 700;}

/* Main card */
.card {background: #fff;border-radius: 8px;border: 1px solid #e6e6e6;padding: 1rem;}

/* Page top (title + description) */
.page-top h1 {margin: 0 0 0.4rem 0;}
.page-top h1 span { text-decoration: underline; }
.page-top .description {color: #555;margin: 0 0 0.25rem 0;}
.page-top .meta {color: #777;font-size: 0.85rem; margin: 0 0 1rem 0;}

/* Two columns */
.layout {display: grid;grid-template-columns: 20% 80%;gap: 1rem;align-items: start; margin-top: 25px; }
aside.sidebar {position: sticky;top: 1rem;}

/* Breadcrumb tree */
ul.tree {list-style: none;}
.tree-nav { background: #f7f7f7;border: 1px solid #e6e6e6;border-radius: 8px;padding: 0.8rem;}
.tree {list-style: none;padding-left: 0.6rem;margin: 0;}
.tree li {margin: 0.2rem 0;}
.tree-item {display: flex;align-items: center;gap: 0.4rem;}
.tree a {text-decoration: none;color: #333;font-size: 0.9rem;}
.tree li.current > .tree-item a { font-weight: bold; color: #FFF; background-color: #0066cc; padding: 2px; }
.tree ul {display: none;padding-left: 1rem;border-left: 1px dashed #ccc;margin-left: 0.4rem;}
.tree li.open > ul {display: block;}
.tree button.toggle {background: none;border: none;cursor: pointer;font-size: 0.7rem;transform: rotate(0deg);transition: transform 0.2s ease;}
.tree li.open > .tree-item button.toggle {transform: rotate(90deg);}

/* Search form in sidebar */
.search-form{ display:flex; gap:8px; width:100%; margin: 0px;}
.search-form input{ flex:1;padding:10px 12px;border:1px solid #ddd;border-radius:10px;}
.search-form button{padding:10px 14px;border:0;border-radius:10px;cursor:pointer;}

/* Content area */
.content-area section {margin-bottom: 1.5rem;padding: 0px 25px;}
.content-area h2 {margin: 0 0 0.75rem 0;font-size: 1.5rem;text-transform: uppercase;}

/* Subpages: 3 columns, icon style, like links */
.subpages-icon-grid {list-style: none;padding: 0;margin: 0;display: grid;grid-template-columns: repeat(4, 1fr);gap: 0.8rem;}
.subpages-icon-grid li {display: flex;align-items: flex-start;gap: 0.8rem;background-color: #efefff;padding: 0.9rem 1rem;border-radius: 6px;border: 1px solid #909090;transition: background 0.2s ease, transform 0.15s ease;}
.subpages-icon-grid li:hover {background-color: #e6e6e6;transform: translateY(-2px);}
.subpages-icon-grid .icon {flex-shrink: 0;width: 28px;height: 28px;color: #fff;display: flex;align-items: center;justify-content: center;border-radius: 50%;font-size: 0.9rem;}
.subpages-icon-grid .content { flex: 1; }
.subpages-icon-grid .content a {font-size: 1.5em; font-weight: 700;}
.subpages-icon-grid .content .description {margin-top: 0.25rem;font-size: 0.85rem;color: #555;}

/* Llista links base */
.icon-list { list-style: none; padding: 0; margin: 0; }
.icon-list li { display: flex; align-items: flex-start; gap: 0.8rem; background-color: #ffffff; padding: 0.9rem 1rem; margin-bottom: 0.6rem; border-radius: 6px; border: 1px solid #e0e0e0; transition: background 0.2s ease, transform 0.15s ease;}
.icon-list li:hover { background-color: #efefef;transform: translateY(-2px);}
.icon-list .icon { flex-shrink: 0; width: 28px; height: 28px; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.9rem;}
.icon-list .content { flex: 1;}
.icon-list .content a { color: #0066cc; text-decoration: none; font-size: 1.2rem; font-weight: 700;}
.icon-list .content a.belong { font-size: 0.8rem; font-weight: normal; }
.icon-list .content .description { margin-top: 0.3rem; font-size: 0.85rem; color: #555; }

/* Share Social links */
.share-links{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top: 10px; }
.share-btn{ display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border:1px solid #ddd; border-radius:8px; text-decoration:none; font-weight:700; line-height:1; user-select:none;}
.share-btn:hover{ transform: translateY(-1px); }

/* Footer */
footer.site-footer { background: #222;color: #fff;padding: 1rem 0; }
footer.site-footer .wrap { font-size: 0.9rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- FORM STYLING ---------- */
form {background: #f9f9f9;border: 1px solid #ddd;border-radius: 6px;padding: 1rem;margin-top: 1.5rem;}
/* Cada camp en una línia */
form label {display: block;margin-bottom: 0.3rem;font-size: 0.9rem;font-weight: bold;}
/* Inputs, URLs i textareas amb padding */
form input[type="text"],
form input[type="url"],
form textarea {width: 100%;padding: 0.5rem;margin-bottom: 0.8rem;border: 1px solid #ccc;border-radius: 4px;font-size: 0.95rem;}
/* Botó negre amb padding */
form button {background-color: #000;color: #fff;border: none;padding: 0.6rem 1.2rem;   /* padding del botó */font-size: 0.95rem;border-radius: 4px;cursor: pointer;}
form button:hover {background-color: #333;}

/* Responsive */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr;}
    aside.sidebar { position: static;}
}

@media (max-width: 768px) {
    .subpages-icon-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .subpages-icon-grid { grid-template-columns: 1fr; }
}