/* =========================================================
   Dashboard Links - Main Stylesheet
   ========================================================= */

:root {
  --brand-color: #2563EB;
  --brand-color-light: #EFF4FF;
  --bg-body: #F5F7FA;
  --bg-white: #FFFFFF;
  --text-dark: #111827;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-dark);
}

a { text-decoration: none; }

/* ---------------------------------------------------
   Layout
--------------------------------------------------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 260px;
  transition: margin-left .2s ease;
}

.main-content {
  padding: 28px 32px;
  flex: 1;
}

.app-footer {
  padding: 16px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-white);
}

/* ---------------------------------------------------
   Sidebar
--------------------------------------------------- */
.sidebar {
  width: 260px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform .2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .brand-icon {
  color: var(--brand-color);
  background: var(--brand-color-light);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.sidebar-menu {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 12px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #374151;
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}

.menu-item i, .menu-item .custom-icon-img {
  width: 18px;
  text-align: center;
  color: var(--text-muted);
}

.menu-item .custom-icon-img {
  height: 18px;
  width: 18px;
  object-fit: contain;
}

.menu-item:hover {
  background: var(--bg-body);
  color: var(--text-dark);
}

.menu-item.active {
  background: var(--brand-color-light);
  color: var(--brand-color);
  font-weight: 600;
}

.menu-item.active i {
  color: var(--brand-color);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

/* ---------------------------------------------------
   Top Header
--------------------------------------------------- */
.top-header {
  height: 68px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.search-box {
  position: relative;
  max-width: 420px;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-box .form-control {
  padding-left: 38px;
  border-radius: 10px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  height: 42px;
}

.search-box .form-control:focus {
  box-shadow: 0 0 0 3px var(--brand-color-light);
  border-color: var(--brand-color);
  background: var(--bg-white);
}

.header-right { margin-left: auto; }

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-white);
  font-weight: 600;
  font-size: 14px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* ---------------------------------------------------
   Page heading
--------------------------------------------------- */
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
}

.page-subtitle {
  color: var(--text-muted);
  margin: 4px 0 0;
  font-size: 14px;
}

.btn-primary {
  background-color: var(--brand-color);
  border-color: var(--brand-color);
  border-radius: 10px;
  font-weight: 600;
  padding: 10px 18px;
}

.btn-primary:hover {
  filter: brightness(0.92);
}

.btn-add-link { white-space: nowrap; }

/* ---------------------------------------------------
   Link Card Grid
--------------------------------------------------- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}

@media (max-width: 1399.98px) {
  .link-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1199.98px) {
  .link-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767.98px) {
  .link-grid { grid-template-columns: 1fr; }
  .main-wrapper { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-hover); }
  .main-content { padding: 20px; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
  .link-grid { grid-template-columns: repeat(3, 1fr); }
}

.link-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
  min-height: 172px;
}

.link-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #DCE3F5;
}

.link-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.link-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--brand-color-light);
  color: var(--brand-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.link-icon .custom-icon-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.link-card-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .15s ease;
}

.link-card:hover .link-card-actions { opacity: 1; }

.icon-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--bg-body);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  transition: background .15s ease, color .15s ease;
}

.icon-action-btn.edit-btn:hover { background: var(--brand-color-light); color: var(--brand-color); }
.icon-action-btn.delete-btn:hover { background: #FEE2E2; color: #DC2626; }

.link-card-body { flex: 1; }

.link-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-dark);
}

.link-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12.5px;
  color: var(--brand-color);
}

.link-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.link-card-footer i { flex-shrink: 0; font-size: 11px; }

.link-card.hidden-by-search { display: none; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 42px; margin-bottom: 12px; opacity: .5; }

/* ---------------------------------------------------
   Tables (management pages)
--------------------------------------------------- */
.table-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.table-card table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 16px;
}

.table-card table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.table-card table tr:last-child td { border-bottom: none; }

.table-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--brand-color-light);
  color: var(--brand-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-icon .custom-icon-img { width: 20px; height: 20px; object-fit: contain; }

.link-url-cell {
  color: var(--brand-color);
  font-size: 13px;
}

/* ---------------------------------------------------
   Login page
--------------------------------------------------- */
.login-body {
  background: linear-gradient(135deg, #EFF4FF 0%, #F5F7FA 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}

.login-wrapper {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  padding: 40px 32px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand-color-light);
  color: var(--brand-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 16px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 2px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.login-card .form-label {
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
  display: block;
}

.login-btn { height: 46px; }

.login-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 20px;
}

/* ---------------------------------------------------
   Misc
--------------------------------------------------- */
.modal-content { border-radius: var(--radius-lg); border: none; }
.form-control, .form-select { border-radius: 10px; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 3px var(--brand-color-light);
}
