* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}
h1 {
    font-size: 18px;
    color: #1f2937;
    display: inline-block;
    font-weight: 600;
}
.main-container {
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(180deg, #f6f7f9 0%, #eef1f4 100%);
    color: #1f2937;
    box-shadow: inset 0 -1px 0 rgba(15,23,42,0.15);
}

.window-header {
    display: flex;
    flex-direction: column;
}

.titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    background-color: #fff;
}

.app-brand {
    margin-left: 16px;
}
#selected {
    margin-bottom: 12px;
    display: none;
}

.app-logo {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
}
.app-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-header {
    font-family: "Gotham Rounded A", "Gotham Rounded B", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.logo-header .navbar-brand {
  margin-left: -15px; 
}
.logo-header a {
  color: #000;
  text-decoration: none;
}
.logo-header a:hover {
  color: #000;
  text-decoration: none;
}
.logo-header .log {
  color: #2e982f;
}
.logo-header .sub {
  color: #fff;
  margin: 0;
  padding: 0;
  font-size: 0.7em;
  position: relative;
  font-weight: 200;
  top: -6px;
  margin-left: 24px;
  letter-spacing: 0.4px;
}
.fw-bold {
    font-weight: 700 !important;
}

.file-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 50px;
    margin-top: 5px;
}

.file-name:hover {
    background-color: rgba(148, 163, 184, 0.2);
}

.file-name:focus {
    outline: 2px solid #3b82f6;
    background-color: white;
}

.menu-bar {
    display: flex;
    padding: 2px 8px;
    padding-top: 1px;
    border-top: 1px solid rgba(148,163,184,0.4);
}

.menu {
    position: relative;
}

.menu-trigger {
    background: none;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
}

.menu-trigger:hover {
    background-color: rgba(37,99,235,0.12);
    color: #1d4ed8;
}

.menu-content {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid rgba(148,163,184,0.45);
    border-radius: 8px;
    box-shadow: 0 14px 28px rgba(15,23,42,0.12);
    padding: 6px;
    display: none;
    flex-direction: column;
    z-index: 100;
}

.menu.open .menu-content {
    display: flex;
}

.menu.open .menu-trigger {
    background-color: rgba(37,99,235,0.12);
    color: #1d4ed8;
}

.menu-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
}

.menu-item:hover {
    background-color: rgba(37,99,235,0.12);
    color: #1d4ed8;
}

.menu-item:disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

/* Submenu styles for Open diagram */
.menu-item-with-submenu {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
}

.menu-item-with-submenu:hover {
    background-color: rgba(37,99,235,0.12);
    color: #1d4ed8;
}

.menu-item-label {
    flex: 1;
}

.submenu-arrow {
    font-size: 10px;
    margin-left: 8px;
    color: #94a3b8;
}

.submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 180px;
    max-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(148,163,184,0.45);
    border-radius: 8px;
    box-shadow: 0 14px 28px rgba(15,23,42,0.12);
    padding: 6px;
    display: none;
    flex-direction: column;
    z-index: 101;
}

.menu-item-with-submenu:hover .submenu {
    display: flex;
}

.submenu-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.submenu-item:hover {
    background-color: rgba(37,99,235,0.12);
    color: #1d4ed8;
}

.submenu-item.disabled {
    color: #94a3b8;
    cursor: default;
    font-style: italic;
}

.submenu-item.disabled:hover {
    background: transparent;
    color: #94a3b8;
}

.toolbar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin: 1px 2px;
}

.main-content {
    display: flex;
    flex: 1;
}

.workspace {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 20%;
    min-width: 200px;
    background-color: white;
    padding: 20px;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1);
    border-left: 1px solid #e5e7eb;
}

.sidebar h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.sidebar strong {
    color: #2c3e50;
}

.mode-indicator {
    margin-top: 20px;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 4px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
}

.canvas-container {
    background-color: white;
    justify-content: center;
    position:relative;
    overflow-x:auto;
    overflow-y:hidden;
}

#canvas {
    background-color: #fefefe;
    cursor: default;
    position:relative;
    height:100%;
}

#canvas.adding-message {
    cursor: crosshair;
}

#canvas.adding-activation,
#canvas.adding-note {
    cursor: crosshair;
}

/* SVG Element Styles */
.lifeline-group {
    cursor: move;
}

.lifeline-box {
}

.lifeline-box.selected {
    stroke: #e74c3c;
    stroke-width: 2;
}

.lifeline-line {
}
.lifeline-line:hover {
    stroke: #000000;
    stroke-width: 2;
}

.lifeline-text {
    user-select: none;
}

.plus-box {
    fill: #5fdf3f;
    stroke: #2c740d;
    stroke-width: 1;
    cursor: pointer;
}
.plus-text {
    fill: #fff;
    font-size: 16px;
    font-weight: bold;
    user-select: none;
    cursor: pointer;
}

.add-lifeline-plus {
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s;
}
.add-lifeline-plus:hover {
    opacity: 1;
}

.message-group {
    cursor: pointer;
}

.message-line.selected, .preview-message-line.selected {
    stroke: #007bff;
    stroke-width: 2;
}

.message-text {
    user-select: none;
    /*pointer-events: none;*/
}

.activation-bar {
    cursor: move;
}

.activation-bar.selected {
    stroke: #007bff;
    stroke-width: 3;
}

.note-group {
    cursor: move;
}

.note-rect {
}

.note-rect.selected {
    stroke: #007bff;
    stroke-width: 3;
}

.note-text {
    user-select: none;
    /*pointer-events: none;*/
}

.note-fold {
}

/* Text Input Overlay */
.text-input-overlay {
    position: fixed;
    border: 2px solid #007bff;
    padding: 5px;
    background-color: white;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 1000;
    outline: none;
}

/* Notification Animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .workspace {
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    }
    
    .menu-bar {
        flex-wrap: wrap;
        gap: 4px;
    }

    .menu-trigger {
        font-size: 12px;
        padding: 6px 8px;
    }

    .file-name {
        font-size: 14px;
    }
}


.color-palette{
  padding:8px;
  background:#fff;
  border:1px solid #e6e9ef;
  border-radius:8px;
  display:flex;
  flex-wrap: wrap;
  gap:8px;
  width: 100%;
}
.color-swatch{width:20px;height:20px;border-radius:4px;display:inline-block;border:2px solid rgba(255,255,255,0.4)}
.color-option{width:28px;height:28px;border-radius:6px;cursor:pointer;border:1px solid #e6eefb}
.noselect{user-select:none}
.color-option.selected {
    border: 1px solid #000000;
}

/* Components view */
#components {
    margin-top: 20px;
}

#components h3 {
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
}

.component-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.component-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.component-item:hover {
    background-color: #e9ecef;
    border-color: #d1d5db;
}

.component-item.selected {
    background-color: #e0e7ff;
    border-color: #6366f1;
}

.component-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.component-name {
    flex: 1;
    font-size: 13px;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.component-name-input {
    flex: 1;
    font-size: 13px;
    color: #1f2937;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    padding: 2px 6px;
    outline: none;
    background-color: white;
}

/* footer */
footer.bg-black {
    color: #999;
    background-color: #f5f5f5 !important;
}
footer .container {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    margin-right: auto;
    margin-left: auto;
}
footer.text-center {
    text-align: center !important;
}
footer.py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
}
footer .px-5 {
    padding-right: 3rem !important;
    padding-left: 3rem !important;
}
footer a {
    color: #999;
    text-decoration: none;
}
.text-white-50 {
    --bs-text-opacity: 1;
    color: #999 !important;
}
small, .small {
    font-size: 0.875em;
}
.mb-2 {
    margin-bottom: 0.5rem !important;
}
.mt-4 {
    margin-top: 1.5rem !important;
}