:root {
  --top-height: 60px;
  --status-height: 30px;
  --panel-bg: #f8f9fa;
  --border-color: #dee2e6;
}
body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  color: #333;
}
.top-controls {
  height: var(--top-height);
  padding: 0 15px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  z-index: 100;
}
.main-container {
  display: flex;
  flex-grow: 1;
  height: calc(100vh - var(--top-height) - var(--status-height));
  overflow: hidden;
}
.status-bar {
  height: var(--status-height);
  background-color: #f1f3f4;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 15px;
  font-size: 12px;
  color: #666;
  justify-content: space-between;
}
.loading-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.left-panel {
  flex: 0 0 calc(60% - 200px);
  background-color: #e9ecef;
  overflow: auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  transition: flex 0.3s ease, background-color 0.3s;
}
.left-panel.expanded {
  flex: 1 1 auto;
}
.left-panel.drag-over {
  background-color: #dae0e5;
  outline: 2px dashed #007bff;
  outline-offset: -10px;
}
.resizer {
  flex: 0 0 4px;
  background: var(--border-color);
  cursor: col-resize;
  transition: background 0.2s;
  position: relative;
  z-index: 10;
}
.resizer:hover { background: #adb5bd; }

/* 境界線上のトグルボタン */
#toggleRightPanelBtn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 48px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 11;
    transition: all 0.2s;
}
#toggleRightPanelBtn:hover {
    background: #f8f9fa;
    color: #666;
    border-color: #adb5bd;
}
.right-panel {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  transition: flex 0.3s ease;
}
.right-panel.collapsed {
  /* Width is controlled by JS snapLayout */
}
.canvas-container {
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background: white;
}
#pdfCanvas, #overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
}
#pdfCanvas { z-index: 1; }
#overlayCanvas { z-index: 2; pointer-events: auto; }
.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 10px;
    border-right: 1px solid var(--border-color);
}
.control-group:last-child { border-right: none; }
.filename-label {
    font-size: 12px;
    color: #888;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#spreadsheet-container {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  /* 横スクロールを確実にするため */
  max-width: 100%;
  transition: flex 0.3s ease;
}

/* Selected row highlight for Jspreadsheet */
.jexcel tbody tr.selected-row td {
    background-color: #fff3cd !important; /* Light yellow/orange */
    border-bottom: 2px solid #ffc107 !important;
    border-top: 2px solid #ffc107 !important;
}

.jexcel tbody tr.selected-row td:first-child {
    border-left: 3px solid #ffc107 !important;
}

.jexcel tbody tr.selected-row td:last-child {
    border-right: 3px solid #ffc107 !important;
}

/* タブ切替のスタイル */
.right-panel-tabs {
    display: flex;
    background: #f1f3f4;
    border-bottom: 1px solid var(--border-color);
}
.tab-item {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    border-right: 1px solid var(--border-color);
    background: #e8eaed;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-item:hover {
    background: #f8f9fa;
}
.tab-item.active {
    background: white;
    color: var(--main-color, #2563eb);
    border-bottom: 2px solid var(--main-color, #2563eb);
    margin-bottom: -1px;
}
.tab-content {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    min-width: 0;
}
.tab-content.active {
    display: flex;
}
.btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #007bff; color: white; border-color: #007bff; }
.btn-primary:hover { background: #0069d9; }
.btn-success { background: #28a745; color: white; border-color: #28a745; }
#text-input-modal {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 300px;
}
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
#rectListArea {
    flex: 1 1 auto;
    padding: 10px;
    overflow-y: auto;
    background: #fafafa;
}

/* Jspreadsheet font size adjustments */
.jexcel thead td {
    font-size: 11px;
    height: 22px; /* 既存の行の高さに合わせる */
    padding: 2px 4px !important;
}

.jexcel tbody td {
    font-size: 11px;
    height: 22px;
}

/* Maintain font size for Text column */
.jexcel tbody td[data-x="0"] {
    font-size: 13px;
}

/* Ad responsive classes */
@media (max-width: 800px) {
    .hidden-mobile {
        display: none !important;
    }
}

/* Tool Boundary Styles (Item 10) */
.top-controls {
    border-bottom: 2px solid #2563eb; /* Stronger primary color border */
}
.main-container {
    background-color: #f0f2f5;
    padding: 5px; /* Slight gap around the tool area */
    box-sizing: border-box;
}
.left-panel {
    border: 1px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    background-color: #dfe3e8; /* Slightly different shade */
}
.right-panel {
    border: 1px solid var(--border-color);
    border-radius: 0 8px 8px 0;
}
.status-bar {
    border-top: 2px solid #2563eb;
}

