/* =========================================================
   NIKHILWORKS TOOLS STUDIO - CANVA-STYLE UNIFIED APP CSS
   ========================================================= */

:root {
  --app-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --code-font: 'JetBrains Mono', monospace;
  
  --app-bg: #071314;
  --sidebar-bg: #0b1f20;
  --card-bg: #10292a;
  --card-hover-bg: #143537;
  --topbar-bg: rgba(11, 31, 32, 0.9);
  
  --brand-lime: #ADFF1C;
  --brand-lime-glow: rgba(173, 255, 28, 0.25);
  --brand-teal: #104041;
  --brand-teal-light: #1b5b5d;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(173, 255, 28, 0.4);
  --border-active: #ADFF1C;
  
  --sidebar-width: 270px;
  --topbar-height: 70px;
}

body.tools-app-body {
  font-family: var(--app-font);
  background-color: var(--app-bg);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--app-bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-lime);
}

/* App Topbar */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-width: 240px;
}

.brand-logo-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #104041 0%, #051a1b 100%);
  border: 1px solid rgba(173, 255, 28, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(173, 255, 28, 0.15);
}

.brand-logo-badge img {
  max-width: 24px;
  height: auto;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-main-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-main-title span {
  color: var(--brand-lime);
}

.brand-sub-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.topbar-search-container {
  flex: 1;
  max-width: 480px;
  margin: 0 20px;
  position: relative;
}

.topbar-search-input {
  width: 100%;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0 42px 0 40px;
  color: #ffffff;
  font-size: 13.5px;
  font-family: var(--app-font);
  outline: none;
  transition: all 0.25s ease;
}

.topbar-search-input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--brand-lime);
  box-shadow: 0 0 0 3px rgba(173, 255, 28, 0.12);
}

.topbar-search-input::placeholder {
  color: var(--text-dim);
}

.topbar-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}

.topbar-search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: var(--code-font);
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.topbar-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.topbar-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.topbar-btn-primary {
  background: var(--brand-lime);
  color: #071314;
  font-weight: 700;
}

.topbar-btn-primary:hover {
  background: #c2ff4d;
  box-shadow: 0 0 16px var(--brand-lime-glow);
  color: #000;
}

.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(173, 255, 28, 0.3);
  padding: 5px 12px 5px 6px;
  border-radius: 30px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-lime);
  color: #071314;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* App Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-subtle);
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1020;
  transition: transform 0.3s ease;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 10px;
  margin-bottom: 8px;
  margin-top: 14px;
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.sidebar-nav-link.active {
  background: rgba(173, 255, 28, 0.1);
  color: var(--brand-lime);
  border-color: rgba(173, 255, 28, 0.25);
  font-weight: 700;
}

.sidebar-nav-link i {
  width: 18px;
  font-size: 13px;
  margin-right: 8px;
}

.nav-count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.sidebar-nav-link.active .nav-count-pill {
  background: var(--brand-lime);
  color: #071314;
}

/* Sidebar Pro Card */
.sidebar-pro-card {
  background: linear-gradient(145deg, #104041 0%, #082122 100%);
  border: 1px solid rgba(173, 255, 28, 0.2);
  border-radius: 14px;
  padding: 14px;
  margin-top: auto;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.sidebar-pro-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pro-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-lime);
  color: #071314;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.pro-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.pro-subtitle {
  font-size: 11px;
  color: #a3c9c9;
}

.sidebar-pro-card p {
  font-size: 11.5px;
  color: #d1e7e7;
  line-height: 1.4;
  margin-bottom: 10px;
}

.sidebar-pro-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  background: var(--brand-lime);
  color: #071314;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-pro-btn:hover {
  background: #c2ff4d;
  color: #000;
}

/* App Main Content Layout */
.app-main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 28px 32px 50px;
  flex: 1;
  min-width: 0;
}

/* Canvas Tool Workspace Container */
.tool-workspace-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 30px 32px;
  margin-bottom: 30px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  position: relative;
}

.tool-workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.tool-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tool-header-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.tool-header-title {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.4px;
  margin-bottom: 3px;
}

.tool-header-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
}

.tool-workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Input Fields inside dark workspace */
.tool-workspace-card .form-label {
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.tool-workspace-card .form-control,
.tool-workspace-card .form-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--app-font);
  transition: all 0.2s;
}

.tool-workspace-card .form-control:focus,
.tool-workspace-card .form-select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--brand-lime);
  box-shadow: 0 0 0 3px rgba(173, 255, 28, 0.15);
  color: #ffffff;
}

.tool-workspace-card .form-control::placeholder {
  color: var(--text-dim);
}

.tool-workspace-card .input-group-text {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* Output Preview Box */
.tool-output-panel {
  background: rgba(7, 19, 20, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}

/* History Slide-over Drawer */
.history-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.history-drawer-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: #0b1f20;
  border-left: 1px solid var(--border-subtle);
  z-index: 1070;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.history-drawer.show {
  transform: translateX(0);
}

.history-drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-drawer-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.history-drawer-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(173, 255, 28, 0.3);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-item-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(173, 255, 28, 0.15);
  color: var(--brand-lime);
}

.history-item-date {
  font-size: 11px;
  color: var(--text-dim);
}

.history-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.history-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.history-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-history-action {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-history-action:hover {
  background: var(--brand-lime);
  color: #071314;
  border-color: var(--brand-lime);
}

.btn-history-action.btn-del:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Toast */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #104041;
  border: 1px solid var(--brand-lime);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 1090;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.app-toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Status Footer */
.app-status-footer {
  background: var(--sidebar-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  margin-top: 40px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #34d399;
  font-weight: 600;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulseGreen 2s infinite ease-in-out;
}

@keyframes pulseGreen {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.footer-links-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links-group a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links-group a:hover {
  color: var(--brand-lime);
}

/* Responsive */
@media (max-width: 991px) {
  .mobile-menu-toggle {
    display: flex;
  }
  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main-content {
    margin-left: 0;
    padding: 20px 16px 40px;
  }
  .topbar-brand {
    min-width: auto;
  }
  .topbar-search-container {
    margin: 0 10px;
  }
  .tool-workspace-card {
    padding: 22px 18px;
  }
}
