@import url('base.css');
@import url('user-info.css');
@import url('commit-button.css');
@import url('push-button.css');
@import url('notification.css');
@import url('session-sync-overlay.css');

/* Git Lock Sign Extension Styles */

/* Lock button styling */
.git-lock-sign-button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin-left: 8px;
  border: 1px solid var(--jp-border-color1);
  border-radius: 3px;
  background: var(--jp-layout-color1);
  color: var(--jp-ui-font-color1);
  font-size: var(--jp-ui-font-size1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.git-lock-sign-button:hover {
  background: var(--jp-layout-color2);
  border-color: var(--jp-border-color2);
}

.git-lock-sign-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.git-lock-sign-button.locked {
  background: var(--jp-warn-color3);
  border-color: var(--jp-warn-color1);
  color: var(--jp-warn-color0);
}

.git-lock-sign-button.locked:hover {
  background: var(--jp-warn-color2);
}

.git-lock-sign-button.loading {
  opacity: 0.8;
}

.git-lock-sign-button .jp-Icon {
  width: 16px;
  height: 16px;
}

.git-lock-sign-button .button-text {
  font-weight: 500;
}

.git-lock-sign-button .error-indicator {
  color: var(--jp-error-color1);
  font-size: 12px;
}

/* Locked cell styling */
.git-lock-sign-locked {
  position: relative;
  opacity: 0.8;
  background: var(--jp-layout-color2) !important;
  border-left: 4px solid var(--jp-warn-color1) !important;
}

.git-lock-sign-locked .jp-InputArea {
  background: var(--jp-layout-color3) !important;
}

.git-lock-sign-locked .jp-InputArea-editor {
  background: var(--jp-layout-color3) !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

.git-lock-sign-locked .jp-OutputArea {
  background: var(--jp-layout-color2) !important;
}

/* CodeMirror specific read-only enforcement */
.git-lock-sign-locked .CodeMirror {
  pointer-events: none !important;
  cursor: not-allowed !important;
  background: var(--jp-layout-color3) !important;
}

.git-lock-sign-locked .CodeMirror-cursor {
  display: none !important;
}

.git-lock-sign-locked .CodeMirror-focused .CodeMirror-cursor {
  display: none !important;
}

.git-lock-sign-locked .CodeMirror-line {
  cursor: not-allowed !important;
  user-select: none !important;
}

/* Disable text selection and editing in locked cells */
.git-lock-sign-locked * {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

/* Disable input elements in locked cells */
.git-lock-sign-locked input,
.git-lock-sign-locked textarea,
.git-lock-sign-locked [contenteditable] {
  pointer-events: none !important;
  cursor: not-allowed !important;
  background: var(--jp-layout-color3) !important;
  opacity: 0.7 !important;
}

/* Prevent focus on locked cell editors */
.git-lock-sign-locked .jp-InputArea-editor:focus,
.git-lock-sign-locked .CodeMirror:focus,
.git-lock-sign-locked .CodeMirror-focused {
  outline: none !important;
  border: none !important;
}

/* Visual indication that cell is read-only */
.git-lock-sign-locked::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 193, 7, 0.1);
  pointer-events: none;
  z-index: 1;
}

/* Lock indicator styling */
.git-lock-sign-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
  background: var(--jp-warn-color3);
  border: 1px solid var(--jp-warn-color1);
  border-radius: 3px;
  padding: 2px 6px;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  font-weight: bold;
}

/* Shortcut blocked notification styling */
.git-lock-sign-shortcut-blocked {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--jp-warn-color3);
  border: 1px solid var(--jp-warn-color1);
  border-radius: 4px;
  padding: 8px 12px;
  z-index: 10000;
  font-size: 12px;
  color: var(--jp-warn-color0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  animation: git-lock-sign-notification-slide-in 0.3s ease-out;
}

@keyframes git-lock-sign-notification-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Disabled toolbar button styling */
.jp-Toolbar button[disabled],
.jp-ToolbarButton[disabled] {
  opacity: 0.5 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

/* Enhanced locked notebook styling */
.git-lock-sign-locked-notebook {
  border: 2px solid var(--jp-warn-color1);
  border-radius: 4px;
  background: rgba(255, 193, 7, 0.05);
}

/* Locked notebook header indicator */
.git-lock-sign-notebook-header {
  background: var(--jp-warn-color3);
  border-bottom: 1px solid var(--jp-warn-color1);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--jp-warn-color0);
  text-align: center;
  font-weight: bold;
}

/* Notebook lock indicator widget styling */
.git-lock-sign-notebook-indicator-widget {
  display: flex;
  align-items: center;
  margin-right: 8px;
}

.git-lock-sign-notebook-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--jp-warn-color3);
  border: 1px solid var(--jp-warn-color1);
  border-radius: 3px;
  color: var(--jp-warn-color0);
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.git-lock-sign-notebook-indicator .lock-icon {
  font-size: 14px;
}

.git-lock-sign-notebook-indicator .lock-text {
  font-weight: 600;
}

/* Hide notebook indicator when not locked */
.git-lock-sign-notebook-indicator-widget:empty {
  display: none;
}


/* Widget container styling */
.git-lock-sign-lock-button-widget {
  display: flex;
  align-items: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .git-lock-sign-button .button-text {
    display: none;
  }

  .git-lock-sign-button {
    padding: 4px;
  }
}

/* Dark theme adjustments */
[data-jp-theme-light="false"] .git-lock-sign-locked {
  background: var(--jp-layout-color0) !important;
}

[data-jp-theme-light="false"] .git-lock-sign-locked .jp-InputArea {
  background: var(--jp-layout-color1) !important;
}

[data-jp-theme-light="false"] .git-lock-sign-locked .jp-InputArea-editor {
  background: var(--jp-layout-color1) !important;
}

/* Animation for loading state */
@keyframes git-lock-sign-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.git-lock-sign-button.loading .jp-CircularProgressIcon {
  animation: git-lock-sign-spin 1s linear infinite;
}
