/* TipsWeb Excel Editor — WordPress Plugin Styles */

/* ── Reset & Wrapper ── */
.tipseb-wrap *,
.tipseb-wrap *::before,
.tipseb-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

.tipseb-wrap {
  --accent:   #1a73e8;
  --accent2:  #1558b0;
  --bg:       #ffffff;
  --surface:  #f4f6f9;
  --surface2: #eef0f4;
  --surface3: #e2e6ed;
  --border:   #d0d5de;
  --border2:  #b8bfcc;
  --text:     #1f2937;
  --text2:    #5f6b7a;
  --text3:    #9aa5b4;
  --red:      #dc2626;
  --cell-h:   26px;
  --hdr-h:    32px;
  --row-w:    48px;

  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  width: 100%;
  min-height: 500px;
  position: relative;
}

/* ── TOP BAR ── */
.tipseb-topbar {
  height: 46px;
  background: var(--accent);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  flex-shrink: 0;
  color: #fff;
}
.tipseb-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.tipseb-logo span { opacity: .85; }
.tipseb-logo-icon { font-size: 18px; }
.tipseb-topbar-center { flex: 1; display: flex; justify-content: center; }
.tipseb-filename {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 12px;
  outline: none;
  min-width: 200px;
  text-align: center;
  transition: background .15s;
}
.tipseb-filename::placeholder { color: rgba(255,255,255,.7); }
.tipseb-filename:focus { background: rgba(255,255,255,.25); }
.tipseb-topbar-actions { display: flex; gap: 8px; }

/* ── BUTTONS ── */
.tipseb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.tipseb-btn:hover { background: var(--surface2); border-color: var(--border2); }
.tipseb-btn-primary {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}
.tipseb-btn-primary:hover { background: rgba(255,255,255,.25); }

/* ── RIBBON ── */
.tipseb-ribbon {
  height: 50px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.tipseb-ribbon::-webkit-scrollbar { height: 3px; }
.tipseb-ribbon::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.tipseb-sep {
  width: 1px; height: 26px;
  background: var(--border);
  margin: 0 5px;
  flex-shrink: 0;
}
.tipseb-rb-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 38px; height: 40px; padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text2);
  font-family: inherit; font-size: 11px; font-weight: 500;
  gap: 2px;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
  white-space: nowrap;
}
.tipseb-rb-btn svg { width: 15px; height: 15px; }
.tipseb-rb-btn:hover { background: var(--surface2); border-color: var(--border); color: var(--text); }
.tipseb-rb-btn.active {
  background: rgba(26,115,232,.1);
  border-color: rgba(26,115,232,.4);
  color: var(--accent);
}
.tipseb-rb-select {
  height: 30px; padding: 0 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text);
  font-family: inherit; font-size: 12px;
  cursor: pointer; outline: none; flex-shrink: 0;
}
.tipseb-rb-select:focus { border-color: var(--accent); }
.tipseb-rb-number {
  width: 52px; height: 30px;
  padding: 0 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text);
  font-family: inherit; font-size: 12px;
  text-align: center; outline: none; flex-shrink: 0;
}
.tipseb-rb-number:focus { border-color: var(--accent); }

/* Colors */
.tipseb-color-group {
  display: flex; flex-direction: column; gap: 2px;
  padding: 2px 5px; flex-shrink: 0;
}
.tipseb-color-label {
  font-size: 9px; font-weight: 600;
  color: var(--text3); letter-spacing: .5px;
}
.tipseb-swatches { display: flex; gap: 3px; align-items: center; }
.tipseb-swatch {
  width: 17px; height: 17px; border-radius: 3px;
  cursor: pointer; border: 1px solid rgba(0,0,0,.15);
  transition: transform .1s;
  flex-shrink: 0;
}
.tipseb-swatch:hover { transform: scale(1.2); }
.tipseb-color-pick {
  width: 17px; height: 17px;
  border: none; padding: 0;
  border-radius: 3px; cursor: pointer;
  background: transparent; flex-shrink: 0;
}

/* ── FORMULA BAR ── */
.tipseb-formulabar {
  height: 34px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  flex-shrink: 0;
}
.tipseb-cell-addr {
  width: 72px; height: 26px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text);
  font-family: 'Courier New', monospace; font-size: 12px;
  text-align: center; outline: none; flex-shrink: 0;
}
.tipseb-cell-addr:focus { border-color: var(--accent); }
.tipseb-fx { color: var(--accent); font-style: italic; font-size: 14px; flex-shrink: 0; }
.tipseb-formula-input {
  flex: 1; height: 26px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text);
  font-family: 'Courier New', monospace; font-size: 12px;
  padding: 0 8px; outline: none;
}
.tipseb-formula-input:focus { border-color: var(--accent); }

/* ── GRID ── */
.tipseb-grid-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.tipseb-grid-container {
  flex: 1;
  overflow: auto;
  background: var(--bg);
  position: relative;
}
.tipseb-grid-container::-webkit-scrollbar { width: 10px; height: 10px; }
.tipseb-grid-container::-webkit-scrollbar-track { background: var(--surface); }
.tipseb-grid-container::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 5px; }
.tipseb-grid-container::-webkit-scrollbar-corner { background: var(--surface); }

.tipseb-table {
  border-collapse: collapse;
  table-layout: fixed;
}
.tipseb-col-header-row th {
  height: var(--hdr-h);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  color: var(--text2);
  position: sticky; top: 0; z-index: 10;
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: background .1s;
}
.tipseb-col-header-row th:hover { background: var(--surface3); color: var(--text); }
.tipseb-corner {
  width: var(--row-w) !important;
  background: var(--surface) !important;
  position: sticky; left: 0; z-index: 20 !important;
}
.tipseb-row-hdr {
  width: var(--row-w);
  height: var(--cell-h);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
  position: sticky; left: 0; z-index: 5;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.tipseb-row-hdr:hover { background: var(--surface3); color: var(--text); }
td.tipseb-cell {
  height: var(--cell-h);
  min-width: 90px;
  max-width: 90px;
  border: 1px solid var(--border);
  padding: 0 5px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--text);
  cursor: cell;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--bg);
  position: relative;
  transition: background .05s;
}
td.tipseb-cell:hover { background: #f0f4ff; }
td.tipseb-cell.tipseb-selected {
  background: rgba(26,115,232,.10) !important;
  border-color: var(--accent) !important;
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  z-index: 2;
}
td.tipseb-cell.tipseb-in-range {
  background: rgba(26,115,232,.05) !important;
  border-color: rgba(26,115,232,.3) !important;
}
td.tipseb-cell.tb-bold      { font-weight: 700; }
td.tipseb-cell.tb-italic    { font-style: italic; }
td.tipseb-cell.tb-underline { text-decoration: underline; }
td.tipseb-cell.tb-left      { text-align: left; }
td.tipseb-cell.tb-center    { text-align: center; }
td.tipseb-cell.tb-right     { text-align: right; }

.tipseb-cell-editor {
  position: absolute;
  top: 0; left: 0;
  min-width: 90px; width: 100%;
  min-height: var(--cell-h);
  background: #fff;
  border: 2px solid var(--accent);
  padding: 3px 5px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text);
  outline: none;
  z-index: 100;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(26,115,232,.2);
}

/* ── SHEET TABS ── */
.tipseb-sheet-bar {
  height: 34px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 8px;
  gap: 3px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.tipseb-sheet-bar::-webkit-scrollbar { height: 3px; }
.tipseb-sheet-bar::-webkit-scrollbar-thumb { background: var(--border2); }
.tipseb-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: var(--text2);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all .13s;
  white-space: nowrap;
  position: relative; bottom: -1px;
}
.tipseb-tab:hover { background: var(--surface2); color: var(--text); }
.tipseb-tab.active { background: var(--bg); border-color: var(--border); color: var(--text); }
.tipseb-tab-close {
  width: 14px; height: 14px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; opacity: 0; transition: opacity .1s;
  border: none; background: transparent; cursor: pointer; color: inherit;
}
.tipseb-tab:hover .tipseb-tab-close { opacity: 1; }
.tipseb-tab-close:hover { background: #fee2e2; color: var(--red); }
.tipseb-add-tab {
  display: flex; align-items: center;
  padding: 0 10px;
  color: var(--text3);
  cursor: pointer;
  font-size: 20px; font-weight: 300;
  transition: color .15s;
  border: none; background: none; font-family: inherit;
}
.tipseb-add-tab:hover { color: var(--accent); }

/* ── STATUS BAR ── */
.tipseb-statusbar {
  height: 26px;
  background: #1558b0;
  color: #fff;
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 20px;
  flex-shrink: 0;
  font-size: 11px; font-weight: 500;
}
.tipseb-statusbar strong { font-weight: 700; }

/* ── FIND BAR ── */
.tipseb-find-bar {
  position: absolute;
  top: 8px; right: 12px;
  background: #fff;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 12px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.tipseb-find-bar.open { display: flex; }
.tipseb-find-bar input {
  height: 28px; padding: 0 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text);
  font-family: inherit; font-size: 12px; outline: none;
  width: 160px;
}
.tipseb-find-bar input:focus { border-color: var(--accent); }

/* ── DROP ZONE ── */
.tipseb-drop-zone {
  position: absolute; inset: 0;
  background: rgba(26,115,232,.06);
  border: 2px dashed var(--accent);
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px; font-weight: 600; color: var(--accent);
  pointer-events: none;
  z-index: 300;
}
.tipseb-drop-zone.show { display: flex; }

/* ── CONTEXT MENU ── */
.tipseb-ctx-menu {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px;
  min-width: 190px;
  z-index: 9999;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  display: none;
}
.tipseb-ctx-menu.open { display: block; }
.tipseb-ctx-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: background .1s;
}
.tipseb-ctx-item:hover { background: var(--surface2); }
.tipseb-ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }
.tipseb-ctx-item.tipseb-danger { color: var(--red); }
.tipseb-ctx-item.tipseb-danger:hover { background: #fee2e2; }
