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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 0;
    overflow: hidden;
    margin: 0;
    height: 100%;
    background: #F1F5F9;
}

.toolbar {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #E2E8F0;
    display: flex;
    gap: 16px;
    align-items: center;
    z-index: 10000;
}

.new-window-btn {
    background: var(--theme-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s, box-shadow 0.2s;
}

.new-window-btn:hover {
    background: var(--theme-primary-hover);
    box-shadow: 0 2px 6px var(--theme-primary-shadow-strong);
}

.new-window-btn:active {
    background: var(--theme-primary-dark);
}

.window-count {
    color: #64748B;
    font-size: 14px;
    font-weight: 500;
}

.window-count span {
    color: var(--theme-primary);
    font-weight: 600;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
}

.window {
    position: absolute;
    width: 400px;
    min-width: 250px;
    min-height: 150px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 16px var(--theme-primary-shadow);
    border: 1px solid #E2E8F0;
    overflow: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.window.minimized {
    min-height: auto;
    height: auto !important;
}

.window.minimized .window-content,
.window.minimized .resize-handle {
    display: none;
}

.window.maximized {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
    top: 0 !important;
    left: 0 !important;
}

.window.maximized .resize-handle {
    display: none;
}

.window-header {
    background: var(--theme-primary);
    color: white;
    padding: 12px 16px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    border-bottom: 1px solid var(--theme-primary-dark);
}

.window-header:active {
    cursor: grabbing;
}

.window-title {
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.window-controls {
    display: flex;
    gap: 4px;
}

.window-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
    font-family: Arial, sans-serif;
}

.window-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.minimize-btn {
    font-size: 18px;
    padding-bottom: 6px;
}

.maximize-btn {
    font-size: 16px;
}

.close-btn {
    font-size: 24px;
}

.close-btn:hover {
    background: #DC2626;
    color: white;
}

.window-content {
    padding: 12px;
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.window-content h2 {
    color: #1E293B;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 600;
}

.window-content p {
    color: #64748B;
    line-height: 1.6;
    margin-bottom: 12px;
}

.info-box {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #E2E8F0;
    max-width: 300px;
}

.info-box h3 {
    color: #1E293B;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.info-box ul {
    list-style: none;
    color: #64748B;
}

.info-box li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
}

.info-box li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--theme-accent);
    font-weight: bold;
}

.resize-handle {
    position: absolute;
    z-index: 10;
}

.resize-top,
.resize-bottom {
    width: 100%;
    height: 8px;
    cursor: ns-resize;
}

.resize-left,
.resize-right {
    width: 8px;
    height: 100%;
    cursor: ew-resize;
}

.resize-top {
    top: 0;
    left: 0;
}

.resize-bottom {
    bottom: 0;
    left: 0;
}

.resize-left {
    left: 0;
    top: 0;
}

.resize-right {
    right: 0;
    top: 0;
}

.resize-top-left,
.resize-top-right,
.resize-bottom-left,
.resize-bottom-right {
    width: 16px;
    height: 16px;
}

.resize-top-left {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.resize-top-right {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.resize-bottom-left {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.resize-bottom-right {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

.window-content .form-buttons {
    margin-top:11px;
}

.window-content .submit-btn {
    width:50%;
}

/* Loading overlay and spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--theme-primary, #3B82F6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}