/* Base */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --blue:#3f82bd; --topbar:#D9EDF7; --text:#2d3436; --muted:#6b7280; --border:#e5e7eb;
  --ok:#2ecc71; --warn:#e67e22; --err:#e74c3c;
  --toolbar-bg:#f8fafc; --toolbar-border:#e2e8f0; --toolbar-hover:#edf2f7;
}
html{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
body{font-family:'Roboto',sans-serif;background:#f8f9fa;color:var(--text);line-height:1.6}
a{color:inherit;text-decoration:none}

/* Header */
.wc-header{background:var(--blue);color:#fff;box-shadow:0 1px 0 rgba(0,0,0,.08)}
.wc-wrap{max-width:1200px;margin:0 auto;padding:10px 12px;display:flex;align-items:center;gap:14px}
.wc-logo{display:inline-flex;align-items:center;gap:8px}
.wc-slab{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;font-weight:900;font-size:14px;border-radius:2px;color:#fff}
.slab-w{background:#1f2327}.slab-o{background:#a7c1db;color:#1e2a3a}.slab-r{background:#7d96ae}.slab-d{background:#2f5d8a}
.wc-brand-text{display:inline-flex;flex-direction:column;line-height:1.05;font-size:19px;font-weight:800}
.wc-brand-text small{font-size:10px;opacity:.95}
.wc-nav{margin-left:10px;display:flex;align-items:center;gap:8px;flex:1}
.wc-link{color:#f4f8fc;font-weight:700;font-size:14px;padding:6px 10px;border-radius:6px;transition:.15s;white-space:nowrap}
.wc-link:hover{background:rgba(255,255,255,.14)}
.wc-link.active{background:#fff;color:#111;box-shadow:0 2px 6px rgba(0,0,0,.15)}
.wc-dropdown{position:relative}
.wc-dropbtn{border:0;background:transparent;cursor:pointer}
.wc-dropdown-menu{display:none;position:absolute;top:calc(100% + 6px);left:0;min-width:180px;background:#fff;border-radius:8px;box-shadow:0 10px 24px rgba(0,0,0,.18);overflow:hidden;z-index:20}
.wc-dropdown:hover .wc-dropdown-menu{display:block}
.wc-dropdown-menu a{display:block;padding:9px 10px;font-size:13px;color:#1f2937;border-bottom:1px solid #eef2f7}
.wc-dropdown-menu a:last-child{border-bottom:none}
.mobile-menu-btn{margin-left:auto;background:transparent;border:0;color:#fff;font-size:20px;display:none;cursor:pointer}
.mobile-nav{position:fixed;top:0;right:-100%;width:320px;height:100vh;background:#2c3e50;box-shadow:-2px 0 10px rgba(0,0,0,.1);transition:right .3s;z-index:100}
.mobile-nav.active{right:0}
.mobile-nav-header{display:flex;justify-content:space-between;align-items:center;padding:16px;border-bottom:1px solid #34495e}
.mobile-close-btn{background:transparent;border:0;color:#fff;font-size:20px;cursor:pointer}
.mobile-nav-links{padding:16px}
.mobile-link{display:block;color:#ecf0f1;padding:12px 0;border-bottom:1px solid #34495e;font-weight:700}
.mobile-dropdown-content{display:none;padding-left:16px}
.mobile-dropdown.active .mobile-dropdown-content{display:block}
.mobile-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:none;z-index:90}
.mobile-overlay.active{display:block}

/* Layout */
.main-container{display:grid;grid-template-columns:1fr 340px;gap:18px;max-width:1200px;margin:18px auto;padding:0 15px}
.editor-section{background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 2px 4px rgba(0,0,0,.08)}

/* Stats top bar */
.stats-top-bar{background:var(--topbar);padding:10px 12px;display:flex;align-items:center;gap:10px}
.stats-container{flex:1}
.stats-text{font-size:24px;font-weight:800;letter-spacing:-.2px}

/* Professional Toolbar */
.toolbar-pro{
  background:var(--toolbar-bg);
  border:1px solid var(--toolbar-border);
  border-radius:8px;
  padding:8px 12px;
  display:flex;
  flex-wrap:nowrap;
  gap:6px;
  align-items:center;
  justify-content:flex-start;
  overflow-x:auto;
  overflow-y:visible;
  position:relative;
  scroll-behavior:smooth;
  -webkit-overflow-scrolling:touch;
  margin:0 12px 12px 12px;
  min-height:60px;
}
.toolbar-pro::-webkit-scrollbar{height:6px}
.toolbar-pro::-webkit-scrollbar-thumb{background:#cbd5e0;border-radius:6px}
.toolbar-pro::-webkit-scrollbar-thumb:hover{background:#a0aec0}

.tb-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  padding:0;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:8px;
  color:#4a5568;
  cursor:pointer;
  font-size:16px;
  transition:all 0.2s ease;
  position:relative;
  flex-shrink:0;
}

.tb-btn:hover{
  background:var(--toolbar-hover);
  border-color:#cbd5e0;
  transform:translateY(-1px);
  box-shadow:0 4px 12px rgba(0,0,0,0.1);
  color:#2d3748;
}

.tb-btn:active{
  transform:translateY(0);
  box-shadow:0 2px 6px rgba(0,0,0,0.1);
}

.tb-btn:focus-visible{
  outline:2px solid #4299e1;
  outline-offset:2px;
}

/* Toolbar Button Tooltips */
.tb-btn::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #2d3748;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tb-btn::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  border: 5px solid transparent;
  border-top-color: #2d3748;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

.tb-btn:hover::after,
.tb-btn:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-12px);
}

/* Special Icons for Case Tools */
.uppercase-icon::before {
  content: "A";
  font-weight: 900;
  font-size: 14px;
}

.lowercase-icon::before {
  content: "a";
  font-weight: 400;
  font-size: 14px;
}

/* Editor */
.editor-textarea{
  min-height:220px;max-height:1000px;height:360px;padding:14px;font-size:14px;line-height:1.6;
  border:none;outline:none;overflow:auto;word-wrap:break-word;position:relative;white-space:pre-wrap
}
.editor-textarea::before{content:attr(data-placeholder);position:absolute;top:14px;left:14px;color:#9aa1a9;font-style:italic;pointer-events:none}
.editor-textarea:not(:empty)::before,.editor-textarea:focus::before{opacity:0}

/* Grammar inline marks */
.lt-error{background:transparent;border-bottom:2px wavy var(--err);text-decoration:none;position:relative;cursor:help}
.lt-error[data-tip]:hover::after{
  content:attr(data-tip);
  position:absolute;left:0;bottom:100%;transform:translateY(-6px);
  background:#111;color:#fff;font-size:12px;line-height:1.4;padding:6px 8px;border-radius:6px;white-space:normal;min-width:220px;max-width:360px;box-shadow:0 6px 24px rgba(0,0,0,.12);z-index:5
}

/* Resize & summary */
.resize-handle{position:relative;height:12px;background:#e6e9ed;border-top:1px solid #d7dbdf;border-bottom:1px solid #dfe3e7;cursor:ns-resize;user-select:none;touch-action:none}
.resize-handle::before{content:"";position:absolute;top:50%;left:50%;width:34px;height:4px;transform:translate(-50%,-50%);background:
 linear-gradient(#bfc6cd,#bfc6cd) left 8px center/6px 2px no-repeat,
 linear-gradient(#bfc6cd,#bfc6cd) center center/6px 2px no-repeat,
 linear-gradient(#bfc6cd,#bfc6cd) right 8px center/6px 2px no-repeat;border-radius:2px;opacity:.9}
.bottom-summary{background:#f1f3f5;border-top:1px solid #e3e6ea;padding:8px 12px;font-weight:700;color:#334155}

/* Explanation */
.explanation-section{padding:18px 18px 10px;background:#fff;border-top:1px solid #e7e8ea;border-radius:0 0 10px 10px}
.explanation-section h2{font-size:18px;font-weight:800;color:#263445;margin-bottom:8px;text-transform:uppercase}
.explanation-section p{font-size:14px;color:#505a66;line-height:1.85;margin-bottom:8px;text-align:justify}

/* Sidebar Panels */
.sidebar{display:flex;flex-direction:column;gap:14px}
.panel{background:#fff;border:1px solid #e6e9ee;border-radius:10px;box-shadow:0 2px 4px rgba(0,0,0,.06);overflow:hidden}
.panel-title{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#f9fafb;border-bottom:1px solid #e6e9ee;font-weight:800;color:#1f2937}
.panel-title i.fa-wrench{color:#143a59}
.panel-toggle{border:0;background:transparent;color:#6b7280;cursor:pointer}
.panel-content{padding:10px 12px}

/* Grammar panel UI */
.grammar-controls{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
.check-btn,.applyall-btn{border:0;border-radius:8px;padding:9px 11px;font-weight:800;cursor:pointer;display:inline-flex;align-items:center;gap:8px;font-size:13px}
.check-btn{background:#27ae60;color:#fff}
.applyall-btn{background:#f1f2f4;color:#111;border:1px solid #e1e5ea}
.applyall-btn:disabled{opacity:.5;cursor:not-allowed}
.grammar-results{display:flex;flex-direction:column;gap:8px}
.issue-card{border:1px solid #eef2f7;border-radius:10px;padding:9px;background:#fff;box-shadow:0 1px 0 rgba(0,0,0,.03)}
.issue-head{display:flex;justify-content:space-between;gap:8px;align-items:center}
.issue-type{font-size:12px;font-weight:800;color:#6b7280;text-transform:uppercase}
.issue-badges{display:flex;gap:6px;align-items:center}
.badge{font-size:11px;font-weight:800;border-radius:999px;padding:2px 8px}
.badge-err{background:#ffe8e8;color:#8a1f1f;border:1px solid #ffcfcf}
.badge-warn{background:#fff4e5;color:#7a3b00;border:1px solid #ffe3bf}
.issue-body{margin-top:6px;color:#334155;font-size:13px}
.issue-actions{display:flex;gap:6px;margin-top:8px}
.btn{border:0;border-radius:6px;padding:7px 9px;font-size:12px;font-weight:800;cursor:pointer}
.btn-apply{background:#2563eb;color:#fff}
.btn-ignore{background:#f3f4f6;color:#111;border:1px solid #e5e7eb}

/* Details */
.stats-list{list-style:none}
.stats-list li{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #eef2f7;padding:7px 0;font-size:13px}
.stats-list li:last-child{border-bottom:none}
.pill{display:inline-flex;min-width:34px;justify-content:center;padding:2px 8px;border-radius:999px;background:#5e6772;color:#fff;font-weight:800;font-size:12px}

/* one-line socials + More */
.details-share{display:flex;justify-content:center;gap:10px;margin-top:10px;flex-wrap:nowrap}
.details-share a{color:#3f82bd;font-size:15px;background:#f5f6f7;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:6px;border:1px solid #dfe3e7;transition:.2s}
.details-share a:hover{background:#3f82bd;color:#fff;transform:translateY(-1px)}
.btn-more-social{padding:6px 10px;border:1px solid #dfe3e7;background:#fff;border-radius:6px;cursor:pointer;font-size:12px}

/* Keyword Density */
.keyword-header{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px solid #eef2f7}
.density-title{font-weight:800}
#density-multiplier{padding:2px 6px;border:1px solid #e1e5ea;border-radius:4px;background:#fff;font-size:12px}
.keyword-list{margin-top:8px}
.keyword-item{display:flex;justify-content:space-between;align-items:center;padding:7px 0;border-bottom:1px solid #eef2f7;font-size:13px}
.keyword-word{font-weight:800;color:#1f2937}
.keyword-badge{background:#6c757d;color:#fff;padding:4px 10px;border-radius:20px;font-size:12px;font-weight:800}

/* Footer */
.site-footer{background:#34495e;color:#bdc3c7;margin-top:50px;padding:40px 0 26px;font-size:14px}
.footer-container{max-width:1200px;margin:0 auto;padding:0 15px;display:flex;justify-content:space-between;gap:34px;flex-wrap:wrap}
.footer-col{flex:1;min-width:220px}
.footer-col h4{font-size:15px;margin-bottom:16px;color:#fff;font-weight:800;position:relative}
.footer-col h4::after{content:"";position:absolute;left:0;bottom:-6px;width:30px;height:2px;background:#16a085}
.footer-col ul{list-style:none}
.footer-col li{margin-bottom:10px}
.footer-col a{color:#bdc3c7}
.footer-col a:hover{color:#16a085}
.social-links{display:flex;gap:12px;margin:14px 0}
.social-links a{font-size:18px}
.copyright{font-size:13px;opacity:.9;margin-top:8px;color:#95a5a6}

/* Modal */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);display:none;z-index:200}
.modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:480px;max-width:92vw;background:#fff;border:1px solid #e6e9ee;border-radius:12px;box-shadow:0 18px 40px rgba(0,0,0,.18);display:none;z-index:210}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid #eef2f7}
.modal-head h3{font-size:16px;font-weight:800;color:#1f2937}
.modal-close{background:#f2f4f7;border:1px solid #e1e5ea;border-radius:8px;padding:6px 8px;cursor:pointer}
.modal-body{padding:12px}
.social-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin:10px 0}
.social-grid button{height:48px;border:1px solid #e1e5ea;border-radius:10px;background:#fff;cursor:pointer;font-size:20px;color:#3f82bd;transition:.15s}
.social-grid button:hover{background:#f0f7ff}
.modal-note{font-size:12px;color:#6b7280;margin-top:6px}

/* Notifications */
.notification{position:fixed;top:18px;right:18px;background:#2c3e50;color:#fff;padding:10px 16px;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);z-index:10000;transform:translateX(100%);transition:transform .3s;max-width:320px;font-size:13px;font-weight:800}
.notification.show{transform:translateX(0)}
@media (max-width:768px){
  .notification{top:10px;right:10px;left:10px;max-width:none;transform:translateY(-100%)}
  .notification.show{transform:translateY(0)}
  .social-grid{grid-template-columns:repeat(4,1fr)}
}

/* History Modal */
.history-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  z-index: 1000;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.history-modal h3 {
  margin: 0 0 16px 0;
  color: #1f2937;
  font-size: 18px;
  font-weight: 800;
}

.history-content {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
  max-height: 400px;
}

.history-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  background: #f9fafb;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: #3b82f6;
  background: #f0f9ff;
}

.history-date {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 6px;
  font-weight: 600;
}

.history-preview {
  font-size: 12px;
  color: #374151;
  margin-bottom: 8px;
  line-height: 1.4;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.history-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-btn.restore {
  background: #3b82f6;
  color: white;
}

.history-btn.delete {
  background: #ef4444;
  color: white;
}

.history-btn.restore:hover {
  background: #2563eb;
}

.history-btn.delete:hover {
  background: #dc2626;
}

.history-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.history-footer-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-footer-btn.close {
  background: #6b7280;
  color: white;
}

.history-footer-btn.clear {
  background: #ef4444;
  color: white;
}

.history-footer-btn.close:hover {
  background: #4b5563;
}

.history-footer-btn.clear:hover {
  background: #dc2626;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

/* Responsive */
@media (max-width:1140px){.wc-nav{gap:6px}}
@media (max-width:1024px){.main-container{grid-template-columns:1fr}.sidebar{margin-top:14px}}
@media (max-width:992px){.wc-nav{display:none}.mobile-menu-btn{display:inline-block}.wc-brand-text{font-size:18px}.wc-slab{width:22px;height:22px;font-size:13px}}
@media (max-width:768px){
  .toolbar-pro{
    margin:0 8px 8px 8px;
    padding:6px 8px;
    gap:4px;
  }
  .tb-btn{
    width:40px;
    height:40px;
    font-size:14px;
  }
}
@media (max-width:480px){
  .editor-textarea{height:300px;padding:12px}
  .mobile-nav{width:280px}
  .toolbar-pro{
    gap:3px;
    padding:4px 6px;
  }
  .tb-btn{
    width:36px;
    height:36px;
    font-size:13px;
  }
}

/* Print */
@media print{
  header,.toolbar,.sidebar,.site-footer,.resize-handle{display:none!important}
  .editor-section{box-shadow:none;border:0}
  .editor-textarea{min-height:auto;height:auto}
  .bottom-summary{display:none}
  @page{margin:20mm}
  body::before{content:"WordCalculator.net";display:block;margin:0 0 8mm 0;font-weight:900;font-size:18px}
}